Main Page Modules Class Hierarchy Compound List File List Compound Members

# cPSquare Class Reference

`#include <cpsquare.h>`

Inheritance diagram for cPSquare::

List of all members.

## Public Methods

Constructors, destructor, assignment.
| cPSquare (const cPSquare &r)
| cPSquare (const char *name=NULL, int cells=10)
virtual | ~cPSquare ()
cPSquare& | operator= (const cPSquare &res)
Redefined cObject member functions.
virtual cObject* | dup () const
virtual int | netPack ()
virtual int | netUnpack ()
virtual void | writeContents (ostream &os)
Redefined member functions from cStatistic and its subclasses.
virtual void | transform ()
virtual void | setRange (double, double)
virtual void | setRangeAuto (int, double)
virtual void | setRangeAutoLower (double, int, double)
virtual void | setRangeAutoUpper (double, int, double)
virtual void | setNumFirstVals (int)
virtual int | cells () const
virtual double | basepoint (int k) const
virtual double | cell (int k) const
virtual double | cdf (double x) const
virtual double | pdf (double x) const
virtual double | random () const
virtual void | saveToFile (FILE *) const
virtual void | loadFromFile (FILE *)

## Protected Methods

virtual void | collectTransformed (double val)

## Detailed Description

Implements the P2 algorithm, which calculates quantile values without storing the observations.

## Constructor & Destructor Documentation

cPSquare::cPSquare ( | const cPSquare & r )

| Copy constructor.

cPSquare::cPSquare ( | const char * name = NULL,
| int cells = 10 )`[explicit]`

| Constructor.

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

| Destructor.

## Member Function Documentation

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

| Returns the kth cell boundary. Note that because of the P2 algorithm, cell boundaries are shifting during data collection, thus cell() and other methods based on cell() and basepoint() return approximate values. Reimplemented from cDensityEstBase.

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

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

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

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

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

| Returns the number of cells used. Reimplemented from cDensityEstBase.

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

| Called internally by collect(), this method updates the P2 data structure with the new value. Reimplemented from cDensityEstBase.

cObject * cPSquare::dup ( | ) const`[inline, virtual]`

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

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

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

int cPSquare::netPack ( | )`[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.

int cPSquare::netUnpack ( | )`[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.

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

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

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

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

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

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

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

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

void cPSquare::setNumFirstVals ( | int num_firstvals )`[inline, virtual]`

| setRange() and setNumFirstVals() methods are not used with cPSquare (the algorithm doesn't require them), but they could not remain pure virtual. Reimplemented from cDensityEstBase.

void cPSquare::setRange ( | double lower,
| double upper )`[inline, virtual]`

| setRange() and setNumFirstVals() methods are not used with cPSquare (the algorithm doesn't require them), but they could not remain pure virtual. Reimplemented from cDensityEstBase.

void cPSquare::setRangeAuto ( | int num_firstvals,
| double range_ext_fact )`[inline, virtual]`

| setRange() and setNumFirstVals() methods are not used with cPSquare (the algorithm doesn't require them), but they could not remain pure virtual. Reimplemented from cDensityEstBase.

void cPSquare::setRangeAutoLower ( | double upper,
| int num_firstvals,
| double range_ext_fact )`[inline, virtual]`

| setRange() and setNumFirstVals() methods are not used with cPSquare (the algorithm doesn't require them), but they could not remain pure virtual. Reimplemented from cDensityEstBase.

void cPSquare::setRangeAutoUpper ( | double lower,
| int num_firstvals,
| double range_ext_fact )`[inline, virtual]`

| setRange() and setNumFirstVals() methods are not used with cPSquare (the algorithm doesn't require them), but they could not remain pure virtual. Reimplemented from cDensityEstBase.

void cPSquare::transform ( | )`[inline, virtual]`

| This method is not used with cPSquare, but it could not remain pure virtual. Reimplemented from cDensityEstBase.

void cPSquare::writeContents ( | 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:

- cpsquare.h