cVarHistogram Class Reference
[Statistical data collection]

#include <cvarhist.h>

Inheritance diagram for cVarHistogram:

cHistogramBase cDensityEstBase cStdDev cStatistic cOwnedObject cNamedObject cObject

List of all members.


Detailed Description

Variable bin size histogram.

You may add cell (bin) boundaries manually, or let the object create cells with equal number of observations in them (or as close to that as possible).

Transform types for cVarHistogram:

Layout of the variable bin width histogram:

        underflow-cell   ordinary cells . . .             overflow-cell
        ...---------|-----------|- ... -|-----------------|---------...
                    | ^cellv[0] |      cellv[num_cells-1]^|
                  n |           |                         |
                rangemin        |                      rangemax
                    |    bin_bounds[1]                    |
              bin_bounds[0]                       bin_bounds[numcells]
 

Rangemin and rangemax is chosen after collecting the num_firstvals initial observations. It is not possible to add cell boundaries when histogram is already transformed.

Now we do support the following 2 uses of cVarHistogram:

  1. add all the boundaries (manually) before collecting observations
  2. collect observations and transform() makes the boundaries

Public Member Functions

Constructors, destructor, assignment.
 cVarHistogram (const cVarHistogram &r)
 cVarHistogram (const char *name=NULL, int numcells=11, int transformtype=HIST_TR_AUTO_EPC_DBL)
virtual ~cVarHistogram ()
cVarHistogramoperator= (const cVarHistogram &res)
Redefined cObject member functions.
virtual cVarHistogramdup () const
virtual void parsimPack (cCommBuffer *buffer)
virtual void parsimUnpack (cCommBuffer *buffer)
Redefined member functions from cStatistic and its subclasses.
virtual void clearResult ()
virtual void transform ()
virtual void collectTransformed (double val)
virtual double random () const
virtual double getPDF (double x) const
virtual double getCDF (double x) const
virtual double getBasepoint (int k) const
virtual double getCellValue (int k) const
virtual void saveToFile (FILE *) const
virtual void loadFromFile (FILE *)
Setting up the histogram.
virtual void addBinBound (double x)

Protected Member Functions

void createEquiprobableCells ()

Constructor & Destructor Documentation

cVarHistogram::cVarHistogram ( const cVarHistogram r  )  [inline]

Copy constructor.

cVarHistogram::cVarHistogram ( const char *  name = NULL,
int  numcells = 11,
int  transformtype = HIST_TR_AUTO_EPC_DBL 
) [explicit]

Constructor.

The third argument can be one of HIST_TR_NO_TRANSFORM, HIST_TR_AUTO_EPC_DBL, HIST_TR_AUTO_EPC_INT. With HIST_TR_NO_TRANSFORM, you can set up cells manually (see addBinBound()), in the other two cases it tries to create equiprobably cells.

virtual cVarHistogram::~cVarHistogram (  )  [virtual]

Destructor.


Member Function Documentation

void cVarHistogram::createEquiprobableCells (  )  [protected]

Used internally to create equiprobable cells from the precollected observations.

This cannot be mixed with manually adding cell boundaries -- if there are already some, an error is raised.

cVarHistogram& cVarHistogram::operator= ( const cVarHistogram res  ) 

Assignment operator.

The name member is not copied; see cNamedObject's operator=() for more details.

virtual cVarHistogram* cVarHistogram::dup (  )  const [inline, virtual]

Creates and returns an exact copy of this object.

See cObject for more details.

Reimplemented from cStdDev.

virtual void cVarHistogram::parsimPack ( cCommBuffer buffer  )  [virtual]

Serializes the object into an MPI send buffer.

Used by the simulation kernel for parallel execution. See cObject for more details.

Reimplemented from cHistogramBase.

virtual void cVarHistogram::parsimUnpack ( cCommBuffer buffer  )  [virtual]

Deserializes the object from an MPI receive buffer Used by the simulation kernel for parallel execution.

See cObject for more details.

Reimplemented from cHistogramBase.

virtual void cVarHistogram::clearResult (  )  [virtual]

Clears the results collected so far.

Reimplemented from cHistogramBase.

virtual void cVarHistogram::transform (  )  [virtual]

Transforms the table of precollected values into an internal histogram structure.

Reimplemented from cHistogramBase.

virtual void cVarHistogram::collectTransformed ( double  val  )  [virtual]

Called internally by collect(), this method collects a value after the histogram has been transformed.

Implements cDensityEstBase.

virtual double cVarHistogram::random (  )  const [virtual]

Generates a random number based on the collected data.

Uses the random number generator set by setGenK().

Reimplemented from cStdDev.

virtual double cVarHistogram::getPDF ( double  x  )  const [virtual]

Returns the value of the Probability Density Function at a given x.

Implements cDensityEstBase.

virtual double cVarHistogram::getCDF ( double  x  )  const [virtual]

Returns the value of the Cumulated Density Function at a given x.

Implements cDensityEstBase.

virtual double cVarHistogram::getBasepoint ( int  k  )  const [virtual]

Returns the kth cell boundary.

Implements cDensityEstBase.

virtual double cVarHistogram::getCellValue ( int  k  )  const [virtual]

Returns the number of observations that fell into the kth histogram cell.

Implements cDensityEstBase.

virtual void cVarHistogram::saveToFile ( FILE *   )  const [virtual]

Writes the contents of the object into a text file.

Reimplemented from cHistogramBase.

virtual void cVarHistogram::loadFromFile ( FILE *   )  [virtual]

Reads the object data from a file, in the format written out by saveToFile().

Reimplemented from cHistogramBase.

virtual void cVarHistogram::addBinBound ( double  x  )  [virtual]

Adds a new bin (cell) boundary.

This method can only be called if HIST_TR_NO_TRANSFORM was specified in the constructor call, and only when the object is still in the initial data collection phase (that is, transform() has been invoked yet).


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

Generated on Wed Apr 3 14:40:28 2013 for OMNeT++ Simulation Library by  doxygen 1.5.5