#include <Distrapprox.hh>
Inheritance diagram for RazorBack::Distrapprox_:


Public Methods | |
| Distrapprox_ (double W) | |
| Constructs an object so that it is ready to do an approximation with a bin width W. More... | |
| void | reset (double W) |
| reset(W): Resets the calling object so that it is ready to do an approximation with a bin width W. More... | |
| void | clear () |
| clear(): clears the calling object. More... | |
| Distrapprox_& | operator+= (double X) |
| +=: adds the value X (a sample from the distribution to be approximated). | |
| void | evaluate () |
| evaluate(): normalise the counts and make the PDF and CDF. | |
| double | low () const |
| Returns the lowest value covered by the approximation. More... | |
| double | high () const |
| Returns the highest value covered by the approximation. More... | |
| virtual double | pdf (double X) const |
| Returns a linearly interpolated value for the PDF. More... | |
| virtual double | cdf (double X) const |
| Returns a linearly interpolated value for the CDF. More... | |
| virtual double | inv_cdf (double Y) const |
| Returns an interpolated value for the inverse CDF, X where CDF(X)=Y. More... | |
| virtual double | mean () const |
| Returns the estimated mean of the distribution. | |
| virtual double | var () const |
| Returns the estimated variance of the distribution. | |
| virtual double | skew () const |
| Returns the skewness of the distribution. | |
| virtual double | kurt () const |
| Returns the kurtosis of the distribution. | |
| virtual double | entropy () const |
| entropy(): approximates the entropy of the distribution. More... | |
| virtual double | random (void) const |
| random(): returns a random value from the approximated distribution. | |
Protected Types | |
| typedef list<Bin_>::iterator | Biniter_ |
Protected Methods | |
| int | bin_index (double X) const |
| double | bin_midpoint (unsigned int Idx) const |
| int | locate_index (double X) const |
| double | lin_intp (double X, const vector< double > &YY, double YYmax) const |
Private Attributes | |
| list<Bin_> | Binlist |
| histogram bins sorted in increasing center order. | |
| double | Width |
| bin width. | |
| vector<double> | |
| approximation of PDF. | |
| vector<double> | Cdf |
| approximation of CDF. | |
| unsigned int | Binno |
| length of Pdf and Cdf. | |
| double | Low |
| double | High |
| lowest and highest X value covered by the bins. | |
| bool | Dirty |
| true when a new value is added. | |
| Randomuni_ | Rand |
| uniform random number generator. | |
| Stat_ | Stat |
| statistics for average and SD. | |
Friends | |
| ostream& | operator<< (ostream &Out, const Distrapprox_ &D) |
| Writes (serializes) a Distrapprox_ object to Out. More... | |
| istream& | operator>> (istream &In, Distrapprox_ &D) |
| Reads (deserializes) a Distrapprox_ object from In. More... | |
|
|
Definition at line 101 of file Distrapprox.hh. |
|
|
Constructs an object so that it is ready to do an approximation with a bin width W. If W<0.0, then its absolute value is used. If W==0.0, then a Badvalexc_ is thrown. Definition at line 125 of file Distrapprox.hh. |
|
|
reset(W): Resets the calling object so that it is ready to do an approximation with a bin width W. All previous data are lost. If W<0.0, then its absolute value is used. If W==0.0, then a Badvalexc_ is thrown. Referenced by Distrapprox_(). |
|
|
clear(): clears the calling object. All data are lost except the histogram bin width. |
|
|
+=: adds the value X (a sample from the distribution to be approximated).
|
|
|
evaluate(): normalise the counts and make the PDF and CDF.
|
|
|
Returns the lowest value covered by the approximation. Throws Forgottenexc_ if evaluate() was not invoked beforehand. Definition at line 152 of file Distrapprox.hh. |
|
|
Returns the highest value covered by the approximation. Throws Forgottenexc_ if evaluate() was not invoked beforehand. Definition at line 163 of file Distrapprox.hh. |
|
|
Returns a linearly interpolated value for the PDF. Throws Forgottenexc_ if evaluate() was not invoked beforehand. Reimplemented from RazorBack::Distrbase_. Definition at line 174 of file Distrapprox.hh. |
|
|
Returns a linearly interpolated value for the CDF. Throws Forgottenexc_ if evaluate() was not invoked beforehand. Reimplemented from RazorBack::Distrbase_. Definition at line 180 of file Distrapprox.hh. |
|
|
Returns an interpolated value for the inverse CDF, X where CDF(X)=Y. Throws Forgottenexc_ if evaluate() was not invoked beforehand. Reimplemented from RazorBack::Distrbase_. Referenced by random(). |
|
|
Returns the estimated mean of the distribution.
Reimplemented from RazorBack::Distrbase_. Definition at line 189 of file Distrapprox.hh. |
|
|
Returns the estimated variance of the distribution.
Reimplemented from RazorBack::Distrbase_. Definition at line 192 of file Distrapprox.hh. |
|
|
Returns the skewness of the distribution.
Reimplemented from RazorBack::Distrbase_. Definition at line 195 of file Distrapprox.hh. |
|
|
Returns the kurtosis of the distribution.
Reimplemented from RazorBack::Distrbase_. Definition at line 198 of file Distrapprox.hh. |
|
|
entropy(): approximates the entropy of the distribution. Throws Forgottenexc_ if evaluate() was not invoked beforehand. Reimplemented from RazorBack::Distrbase_. |
|
|
random(): returns a random value from the approximated distribution.
Reimplemented from RazorBack::Distrbase_. Definition at line 207 of file Distrapprox.hh. |
|
|
Definition at line 244 of file Distrapprox.hh. |
|
|
Definition at line 248 of file Distrapprox.hh. |
|
|
|
|
|
|
|
|
Writes (serializes) a Distrapprox_ object to Out. The format is:-
DISTRAPPROX
WIDTH = 0.1
STAT
N = 1000
MIN = -4.7362
MAX = 6.30655
SUM = 957.413
SUM2 = 4575.58
SUM3 = 11291.8
SUM4 = 57072.3
ENDSTAT
-47 1 <-- bin offset index and bin count, see Bin_
-45 3
...
61 2
63 1
ENDDISTRAPPROX
|
|
|
Reads (deserializes) a Distrapprox_ object from In. See operator<< for a format description. |
|
|
histogram bins sorted in increasing center order.
Definition at line 106 of file Distrapprox.hh. |
|
|
bin width.
Definition at line 107 of file Distrapprox.hh. |
|
|
approximation of PDF.
Definition at line 108 of file Distrapprox.hh. |
|
|
approximation of CDF.
Definition at line 109 of file Distrapprox.hh. |
|
|
length of Pdf and Cdf.
Definition at line 110 of file Distrapprox.hh. |
|
|
Definition at line 111 of file Distrapprox.hh. |
|
|
lowest and highest X value covered by the bins.
Definition at line 111 of file Distrapprox.hh. |
|
|
true when a new value is added.
Definition at line 112 of file Distrapprox.hh. |
|
|
uniform random number generator.
Definition at line 113 of file Distrapprox.hh. Referenced by random(). |
|
|
statistics for average and SD.
Definition at line 114 of file Distrapprox.hh. |
1.2.6 written by Dimitri van Heesch,
© 1997-2001