HyperPlot  v1
Bin and visualise multidimensional datasets
Public Member Functions | Protected Attributes | List of all members
Weights Class Reference

Detailed Description

HyperPlot, Author: Sam Harnew, sam.h.nosp@m.arne.nosp@m.w@gma.nosp@m.il.c.nosp@m.om , Date: Dec 2015

Holds a vector of weights that is associtated to a HyperPoint via inheritance (sometimes useful to have more than one for systematic studies)

Definition at line 23 of file Weights.h.

#include <Weights.h>

Inheritance diagram for Weights:
HyperPoint

Public Member Functions

 Weights ()
 
 Weights (double weight)
 
int numWeights () const
 
const std::vector< double > & getWeightsVector ()
 
void printWeight (std::ostream &os=std::cout, int endline=1) const
 
double getWeight (int i=0) const
 
void setWeight (int i, double w)
 
void setWeight (double w)
 
void addWeight (const double &weight)
 

Protected Attributes

std::vector< double > _weights
 

Constructor & Destructor Documentation

Weights::Weights ( )

Empty constructor

Definition at line 5 of file Weights.cpp.

Weights::Weights ( double  weight)

Construct instance with a single weight (probably the most used scenario)

Definition at line 12 of file Weights.cpp.

Member Function Documentation

void Weights::addWeight ( const double &  weight)

Add weight to the end of the weight vector

Definition at line 71 of file Weights.cpp.

double Weights::getWeight ( int  i = 0) const

Get weight i. If no weights exist just return 1.0.

Definition at line 40 of file Weights.cpp.

const std::vector<double>& Weights::getWeightsVector ( )
inline

return the vector of weights

Definition at line 36 of file Weights.h.

int Weights::numWeights ( ) const

How many weights have been stored

Definition at line 20 of file Weights.cpp.

void Weights::printWeight ( std::ostream &  os = std::cout,
int  endline = 1 
) const

print weights to specified ostream (default is cout)

Definition at line 26 of file Weights.cpp.

void Weights::setWeight ( int  i,
double  w 
)

Set weight i to specified value - if this weight doesn't yet exist, keep adding weights of 1.0 until it does

Definition at line 52 of file Weights.cpp.

void Weights::setWeight ( double  w)

Set weight i=0 to desired value

Definition at line 65 of file Weights.cpp.

Member Data Documentation

std::vector<double> Weights::_weights
protected

vector of weights

Definition at line 27 of file Weights.h.


The documentation for this class was generated from the following files: