- Main Page
- Modules
- Classes
- Files
- Directories
- Related Pages

- Class List
- Class Hierarchy
- Class Members

# cKSplit Class Reference
[Statistical data collection]

`#include <cksplit.h>`

Inheritance diagram for cKSplit:

List of all members.

## Detailed Description

Implements k-split, an adaptive histogram-like density estimation algorithm.

See also:
  Iterator Grid

## Public Types
typedef int(* | CritFunc )(const cKSplit &, cKSplit::Grid &, int, double *)
typedef double(* | DivFunc )(const cKSplit &, cKSplit::Grid &, double, double *)
## Public Member Functions
Constructors, destructor, assignment.
| cKSplit (const cKSplit &r)
| cKSplit (const char *name=NULL)
virtual | ~cKSplit ()
cKSplit & | operator= (const cKSplit &res)
Redefined cObject member functions.
virtual cPolymorphic * | dup () const
virtual void | writeContents (std::ostream &os)
virtual void | netPack (cCommBuffer *buffer)
virtual void | netUnpack (cCommBuffer *buffer)
Redefined member functions from cStatistic and its subclasses.
virtual void | transform ()
virtual int | cells () const
virtual double | basepoint (int k) const
virtual double | cell (int k) const
virtual double | pdf (double x) const
virtual double | cdf (double x) const
virtual double | random () const
virtual void | saveToFile (FILE *) const
virtual void | loadFromFile (FILE *)
Configuring the k-split algorithm.
void | setCritFunc (CritFunc _critfunc, double *_critdata)
void | setDivFunc (DivFunc _divfunc, double *_divdata)
void | rangeExtension (bool enabled)
Querying the k-split data structure.
int | treeDepth () const
int | treeDepth (Grid &grid) const
double | realCellValue (Grid &grid, int cell) const
void | printGrids () const
Grid & | grid (int k) const
Grid & | rootGrid () const
## Protected Member Functions
virtual void | collectTransformed (double val)
## Classes
struct | Grid
| Supporting struct for cKSplit. More...
class | Iterator
| Walks along cells of the distribution stored in a cKSplit object. More...

## Constructor & Destructor Documentation

cKSplit::cKSplit | ( | const cKSplit & | r | ) |

| Copy constructor.

cKSplit::cKSplit | ( | const char * | name = `NULL` | ) | `[explicit]`

| Constructor.

virtual cKSplit::~cKSplit | ( |  | ) | `[virtual]`

| Destructor.

## Member Function Documentation

virtual double cKSplit::basepoint | ( | int | k | ) | const`[virtual]`

| Returns the kth cell boundary. Implements cDensityEstBase.

virtual double cKSplit::cdf | ( | double | x | ) | const`[virtual]`

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

virtual double cKSplit::cell | ( | int | k | ) | const`[virtual]`

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

virtual int cKSplit::cells | ( |  | ) | const`[virtual]`

| Returns the number of histogram cells used. Implements cDensityEstBase.

virtual void cKSplit::collectTransformed | ( | double | val | ) | `[protected, virtual]`

| Called internally by collect(), this method updates the k-split data structure with the new value. Implements cDensityEstBase.

virtual cPolymorphic* cKSplit::dup | ( |  | ) | const`[inline, virtual]`

| Creates and returns an exact copy of this object. See cObject for more details. Reimplemented from cStdDev.

Grid& cKSplit::grid | ( | int | k | ) | const`[inline]`

| Returns the kth grid in the k-split data structure.

virtual void cKSplit::loadFromFile | ( | FILE * |  | ) | `[virtual]`

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

virtual void cKSplit::netPack | ( | cCommBuffer * | buffer | ) | `[virtual]`

| 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 cDensityEstBase.

virtual void cKSplit::netUnpack | ( | cCommBuffer * | buffer | ) | `[virtual]`

| 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 cDensityEstBase.

cKSplit& cKSplit::operator= | ( | const cKSplit & | res | ) |

| Assignment operator. The name member doesn't get copied; see cObject's operator=() for more details.

virtual double cKSplit::pdf | ( | double | x | ) | const`[virtual]`

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

void cKSplit::printGrids | ( |  | ) | const

| Dumps the contents of the k-split data structure to ev.

virtual double cKSplit::random | ( |  | ) | const`[virtual]`

| Generates a random number based on the collected data. Uses the random number generator set by setGenK(). Reimplemented from cStdDev.

void cKSplit::rangeExtension | ( | bool | enabled | ) |

| Enables/disables range extension. If range extension is enabled, a new observation that falls outside the k-split range (ie. outside the root grid) will cause the range to be expanded (i.e. new root grid(s) to be placed above the current root grid). If range extension is disabled, such observations will simply be counted as underflows or overflows.

double cKSplit::realCellValue | ( | Grid & | grid,
|  | int | cell
| ) | const

| Returns the actual amount of observations in cell 'cell' of 'grid'. This is not necessarily an integer value because of previous cell splits.

Grid& cKSplit::rootGrid | ( |  | ) | const`[inline]`

| Returns the root grid of the k-split data structure.

virtual void cKSplit::saveToFile | ( | FILE * |  | ) | const`[virtual]`

| Writes the contents of the object into a text file. Reimplemented from cDensityEstBase.

void cKSplit::setCritFunc | ( | CritFunc | _critfunc,
|  | double * | _critdata
| ) |

| Configures the k-split algorithm by supplying a custom split criterion function.

void cKSplit::setDivFunc | ( | DivFunc | _divfunc,
|  | double * | _divdata
| ) |

| Configures the k-split algorithm by supplying a custom cell division function.

virtual void cKSplit::transform | ( |  | ) | `[virtual]`

| Transforms the table of pre-collected values into the k-split data structure. Implements cDensityEstBase.

int cKSplit::treeDepth | ( | Grid & | grid | ) | const

| Returns the depth of the k-split tree measured from the specified grid.

int cKSplit::treeDepth | ( |  | ) | const

| Returns the depth of the k-split tree.

virtual void cKSplit::writeContents | ( | std::ostream & | os | ) | `[virtual]`

| Writes textual information about this object to the stream. See cObject for more details. Reimplemented from cDensityEstBase.

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

- cksplit.h