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

- Class List
- Class Hierarchy
- Class Members

# cDoubleHistogram Class Reference
[Statistical data collection]

`#include <chist.h>`

Inheritance diagram for cDoubleHistogram:

List of all members.

## Detailed Description

Equidistant histogram for doubles.

cDoubleHistogram is derived from cEqdHistogramBase which contains most of the functionality.

- the number of cells is exactly num_cells, if specified using setNumCells() or as an argument to the constructor;
- if the number of cells is not specified, it will default to 10.
- the histogram range can be specified explicitly (via setRange()), or can be determined automatically, after collecting a number of initial observations (setRangeAuto(), setRangeAutoUpper(), setRangeAutoLower()).
- the number of inition observations to collect for range determination can be set via setNumFirstVals().

Examples:

The following histogram will determine the range from the first few observations, then it set up 10 equal-size cells on it:

     cDoubleHistogram hist("hist");

This one will create 30 cells, after determining the range from the first few observations:

     cDoubleHistogram hist("hist");
     hist.setNumCells(30);

To explicitly control the cells, you can use the following:

     cDoubleHistogram hist("hist");
     hist.setRange(0,3);
     hist.setNumCells(30);

If you only know that the numbers will be nonnegative, but you don't know their ranges, you can use the following (which will set up 20 cells, between 0 and an auto-determined limit):

     cDoubleHistogram hist("hist");
     hist.setRangeAutoUpper(0);
     hist.setNumCells(20);

## Public Member Functions
Constructors, destructor, assignment.
| cDoubleHistogram (const cDoubleHistogram &r)
| cDoubleHistogram (const char *name=NULL, int numcells=-1)
virtual | ~cDoubleHistogram ()
cDoubleHistogram & | operator= (const cDoubleHistogram &)
Redefined cObject member functions.
virtual cPolymorphic * | dup () const
Redefined member functions from cStatistic and its subclasses.
virtual double | random () const
## Protected Member Functions
virtual void | setupRange ()

## Constructor & Destructor Documentation

cDoubleHistogram::cDoubleHistogram | ( | const cDoubleHistogram & | r | ) | `[inline]`

| Copy constructor.

cDoubleHistogram::cDoubleHistogram | ( | const char * | name = `NULL`,
|  | int | numcells = `-1`
| ) | `[explicit]`

| Constructor.

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

| Destructor.

## Member Function Documentation

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

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

cDoubleHistogram& cDoubleHistogram::operator= | ( | const cDoubleHistogram & |  | ) | `[inline]`

| Assignment is not supported by this class: this method throws a cRuntimeError when called.

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

| Returns a random number based on the distribution collected. If no values have been collected, it returns 0; when in initial collection phase, it returns one of the stored observations; after the histogram has been set up, a random integer is returned. Reimplemented from cStdDev.

virtual void cDoubleHistogram::setupRange | ( |  | ) | `[protected, virtual]`

| Called internally by transform(), this method should determine and set up the histogram range. It also calculates the cell size. Reimplemented from cEqdHistogramBase.

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

- chist.h