#include <cdensity.h>
Inheritance diagram for cDensityEstBase::
Public Methods | |
Constructors, destructor, assignment. | |
cDensityEstBase (const cDensityEstBase &r) | |
cDensityEstBase (const char *name=NULL) | |
virtual | ~cDensityEstBase () |
cDensityEstBase& | operator= (const cDensityEstBase &res) |
Redefined cObject member functions. | |
virtual void | writeContents (ostream &os) |
virtual int | netPack () |
virtual int | netUnpack () |
Redefined cStatistic member functions. | |
virtual void | collect (double val) |
virtual void | clearResult () |
virtual double | random () const=0 |
virtual void | saveToFile (FILE *) const |
virtual void | loadFromFile (FILE *) |
Selecting the method of setting up the histogram range. | |
virtual void | setRange (double lower, double upper) |
virtual void | setRangeAuto (int num_firstvals, double range_ext_fact) |
virtual void | setRangeAutoLower (double upper, int num_firstvals, double range_ext_fact) |
virtual void | setRangeAutoUpper (double lower, int num_firstvals, double range_ext_fact) |
virtual void | setNumFirstVals (int num_firstvals) |
Transformation. | |
virtual bool | transformed () const |
virtual void | transform ()=0 |
Accessing histogram cells. | |
virtual int | cells () const=0 |
virtual double | basepoint (int k) const=0 |
virtual double | cell (int k) const=0 |
virtual double | cellPDF (int k) const |
virtual unsigned long | underflowCell () const |
virtual unsigned long | overflowCell () const |
Density and cumulated density approximation functions. | |
virtual double | pdf (double x) const=0 |
virtual double | cdf (double x) const=0 |
Protected Methods | |
virtual void | setupRange () |
virtual void | collectTransformed (double val)=0 |
For the histogram classes, you need to specify the number of cells and the range. Range can either be set explicitly or you can choose automatic range determination.
Automatic range estimation works in the following way:
You may also explicitly specify the lower or upper limit and have the other end of the range estimated automatically. The setRange...() member functions of cDensityEstBase deal with setting up the histogram range. It also provides pure virtual functions transform() etc.
Subsequent observations are placed in the histogram structure. If an observation falls out of the histogram range, the underflow or the overflow cell is incremented.
layout of the histogram:
underflow-cell ordinary cells overflow-cell
...----------|----|----|----|----|----|----|--------- ...
| |
| |
rangemin rangemax
|
Copy constructor. |
|
Constructor. |
|
Destructor. |
|
Returns the kth cell boundary. Legal values for k are 0 through cells(), that is, there' one more basepoint than the number of cells. Basepoint(0) returns the low end of the first cell, and basepoint(cells()) returns the high end of the last histogram cell. This method is pure virtual, implementation is provided in subclasses. Reimplemented in cEqdHistogramBase, cKSplit, cPSquare, and cVarHistogram. |
|
Returns the estimated value of the Cumulated Density Function at a given x. This is a pure virtual function, implementation is provided in subclasses implementing concrete histogram types. Reimplemented in cEqdHistogramBase, cKSplit, cPSquare, and cVarHistogram. |
|
Returns the number of observations that fell into the kth histogram cell. Before transformation, this method may return zero. See transform(). This method is pure virtual, implementation is provided in subclasses. Reimplemented in cEqdHistogramBase, cKSplit, cPSquare, and cVarHistogram. |
|
Returns the estimated value of the Probability Density Function within the kth cell. This method simply divides the number of observations in cell k with the cell size and the number of total observations collected. Note that before transformation, cell() and also this method may return zero. See transform(). |
|
Returns the number of histogram cells used. This method is pure virtual, implementation is provided in subclasses. Reimplemented in cHistogramBase, cKSplit, and cPSquare. |
|
Clears the results collected so far. Reimplemented from cStdDev. Reimplemented in cHistogramBase, and cVarHistogram. |
|
Collects one value. Before the histogram was transformed, this method simply adds the value to the table of pre-collected values. When the number of pre-collected samples reaches a limit, the transform() method is called. After transformation, it calls collectTransformed() to update the stored statistics with this value. Reimplemented from cStdDev. Reimplemented in cLongHistogram. |
|
Called internally by collect(), this method collects a value after the histogram has been transformed. Updating the underflow/overflow cells must be handled within this function. This is a pure virtual function; it must be redefined in subclasses. Reimplemented in cEqdHistogramBase, cKSplit, cPSquare, and cVarHistogram. |
|
Reads the object data from a file, in the format written out by saveToFile(). Reimplemented from cStdDev. Reimplemented in cHistogramBase, cEqdHistogramBase, cKSplit, cPSquare, and cVarHistogram. |
|
Serializes the object into a PVM or MPI send buffer. Used by the simulation kernel for parallel execution. See cObject for more details. Reimplemented from cStdDev. Reimplemented in cHistogramBase, cEqdHistogramBase, cLongHistogram, cDoubleHistogram, cKSplit, cPSquare, and cVarHistogram. |
|
Deserializes the object from a PVM or MPI receive buffer Used by the simulation kernel for parallel execution. See cObject for more details. Reimplemented from cStdDev. Reimplemented in cHistogramBase, cEqdHistogramBase, cLongHistogram, cDoubleHistogram, cKSplit, cPSquare, and cVarHistogram. |
|
Assignment operator. The name member doesn't get copied; see cObject's operator=() for more details. |
|
Returns number of observations that, being too large, fell out of the histogram range. |
|
Returns the estimated value of the Probability Density Function at a given x. This is a pure virtual function, implementation is provided in subclasses implementing concrete histogram types. Reimplemented in cEqdHistogramBase, cKSplit, cPSquare, and cVarHistogram. |
|
Generates a random number based on the collected data. Uses the random number generator set by setGenK(). This is a pure virtual function; it must be redefined in subclasses. Reimplemented from cStdDev. Reimplemented in cLongHistogram, cDoubleHistogram, cKSplit, cPSquare, and cVarHistogram. |
|
Writes the contents of the object into a text file. Reimplemented from cStdDev. Reimplemented in cHistogramBase, cEqdHistogramBase, cKSplit, cPSquare, and cVarHistogram. |
|
Sets the number of values to be pre-collected before transformation takes place. See transform(). Reimplemented in cPSquare. |
|
Sets the histogram range explicitly to [lower, upper]. When this method is used, setNumFirstVals() is not needed. Reimplemented in cPSquare. |
|
Selects a histogram range setup method where the range will be determined entirely from a set of pre-collected values. When called, the histogram range will be determined from the first num_firstvals values, extending their range symmetrically by range_ext_fact. For example, after a call to setRangeAuto(100, 1.3), the histogram will be set up after pre-collecting 100 values, the range being the range of the 100 pre-collected values extended 1.3 times symmetrically. Reimplemented in cPSquare. |
|
Selects a histogram range setup method where the upper bound of the range is fixed and the lower bound is determined from a set of pre-collected values. FIXME: details! Reimplemented in cPSquare. |
|
Selects a histogram range setup method where the lower bound of the range is fixed and the upper bound is determined from a set of pre-collected values. FIXME: details! Reimplemented in cPSquare. |
|
Called internally by transform(), this method should determine and set up the histogram range, based on the pre-collected data and the range setup method selected by calls to the setRange(), setRangeAuto(), setRangeAutoLower(), setRangeAutoUpper() methods. Reimplemented in cEqdHistogramBase, and cLongHistogram. |
|
Transforms the table of pre-collected values into an internal histogram structure. This is a pure virtual function. Implementations of transform() are expected to call setupRange(), and set the transfd flag when transformation was successfully done. Reimplemented in cHistogramBase, cKSplit, cPSquare, and cVarHistogram. |
|
Returns whether the object is transformed. See transform(). |
|
Returns number of observations that, being too small, fell out of the histogram range. |
|
Writes textual information about this object to the stream. See cObject for more details. Reimplemented from cStdDev. |