#include <ckstatistics.h>
Public Member Functions | |
CkSampleT (void) | |
void | add (real r) |
Add this value to the sample set. | |
void | operator+= (real r) |
Shorthand for add function. | |
void | add (const CkSampleT< real, ret > &errs) |
Add all these samples to this set. | |
ret | getMean (void) const |
Return the mean value of this sample--the "average" value, in (value) units. | |
ret | getVariance (void) const |
Return the variance of this sample, in (value^2) units. | |
ret | getStddev (void) const |
Return the standard deviation of this sample, in (value) units. | |
real | getMin (void) const |
Return the smallest value encountered. | |
real | getMax (void) const |
Return the largest value encountered. | |
int | getCount (void) const |
Return the number of values in this sample. | |
ret | getRMS (void) const |
Return the RMS value of this variable (square root of sum of squares over number). | |
void | print (FILE *dest) |
Print a textual description of this sample to this FILE. | |
void | printMinAveMax (FILE *dest) |
Print a terse textual description of this sample to this FILE. | |
void | print (void) |
Print a textual description of this sample to stdout. | |
void | pup (PUP::er &p) |
Pup routine, for migration and parameter marshalling. | |
Private Attributes | |
real | lo |
real | hi |
ret | sum |
ret | sq |
int | n |
Friends | |
void | operator| (PUP::er &p, CkSampleT< real, ret > &s) |
It maintains information it can use to compute means and variances, max and min.
The REAL template parameter is the datatype of the values. The RET template parameter is the datatype of the various accumulators used, and the datatype for the derived parameters.
The CkSample typedef is just CkSampleT<double,double> Other sensible specializations might include CkSampleT<double, long double> for higher precision accumulation, or CkSampleT<int, double> for computing continuous statistics of a discrete distribution.
Definition at line 28 of file ckstatistics.h.
Definition at line 34 of file ckstatistics.h.
References CkSampleT< real, ret >::hi, CkSampleT< real, ret >::lo, CkSampleT< real, ret >::n, CkSampleT< real, ret >::sq, and CkSampleT< real, ret >::sum.
Add this value to the sample set.
This function updates the max, min, and mean and variance for this sample.
Definition at line 44 of file ckstatistics.h.
References CkSampleT< real, ret >::hi, CkSampleT< real, ret >::lo, CkSampleT< real, ret >::n, r, CkSampleT< real, ret >::sq, and CkSampleT< real, ret >::sum.
void CkSampleT< real, ret >::add | ( | const CkSampleT< real, ret > & | errs | ) | [inline] |
Add all these samples to this set.
Definition at line 55 of file ckstatistics.h.
References CkSampleT< real, ret >::hi, CkSampleT< real, ret >::lo, CkSampleT< real, ret >::n, CkSampleT< real, ret >::sq, and CkSampleT< real, ret >::sum.
Return the mean value of this sample--the "average" value, in (value) units.
Computed as the sum of all values divided by the number of values.
Definition at line 67 of file ckstatistics.h.
References CkSampleT< real, ret >::n, and CkSampleT< real, ret >::sum.
Referenced by CkSampleT< real, ret >::print(), and CkSampleT< real, ret >::printMinAveMax().
Return the variance of this sample, in (value^2) units.
Computed as the sum of the squares of the diffences between each value and the mean, divided by the number of values minus 1.
Definition at line 75 of file ckstatistics.h.
References CkSampleT< real, ret >::n, CkSampleT< real, ret >::sq, and CkSampleT< real, ret >::sum.
Referenced by CkSampleT< real, ret >::getStddev().
Return the standard deviation of this sample, in (value) units.
Computed as the square root of the variance.
Definition at line 82 of file ckstatistics.h.
References CkSampleT< real, ret >::getVariance().
Referenced by CkSampleT< real, ret >::print().
Return the smallest value encountered.
Definition at line 88 of file ckstatistics.h.
References CkSampleT< real, ret >::lo.
Referenced by CkSampleT< real, ret >::print(), and CkSampleT< real, ret >::printMinAveMax().
Return the largest value encountered.
Definition at line 92 of file ckstatistics.h.
References CkSampleT< real, ret >::hi.
Referenced by CkSampleT< real, ret >::print(), and CkSampleT< real, ret >::printMinAveMax().
Return the number of values in this sample.
Definition at line 96 of file ckstatistics.h.
References CkSampleT< real, ret >::n.
Referenced by CkSampleT< real, ret >::print().
Return the RMS value of this variable (square root of sum of squares over number).
Definition at line 99 of file ckstatistics.h.
References CkSampleT< real, ret >::n, and CkSampleT< real, ret >::sq.
Print a textual description of this sample to this FILE.
For example, a 1,000,000-value sample of a uniform distribution on [0,1] might give: ave= 0.500367 stddev= 0.288663 min= 1.27012e-06 max= 0.999999 n= 1000000
Definition at line 106 of file ckstatistics.h.
References CkSampleT< real, ret >::getCount(), CkSampleT< real, ret >::getMax(), CkSampleT< real, ret >::getMean(), CkSampleT< real, ret >::getMin(), and CkSampleT< real, ret >::getStddev().
void CkSampleT< real, ret >::printMinAveMax | ( | FILE * | dest | ) | [inline] |
Print a terse textual description of this sample to this FILE.
Definition at line 114 of file ckstatistics.h.
References CkSampleT< real, ret >::getMax(), CkSampleT< real, ret >::getMean(), and CkSampleT< real, ret >::getMin().
Print a textual description of this sample to stdout.
Definition at line 122 of file ckstatistics.h.
Pup routine, for migration and parameter marshalling.
Definition at line 125 of file ckstatistics.h.
References CkSampleT< real, ret >::hi, CkSampleT< real, ret >::lo, CkSampleT< real, ret >::n, CkSampleT< real, ret >::sq, and CkSampleT< real, ret >::sum.
Definition at line 130 of file ckstatistics.h.
Definition at line 29 of file ckstatistics.h.
Referenced by CkSampleT< real, ret >::add(), CkSampleT< real, ret >::CkSampleT(), CkSampleT< real, ret >::getMin(), and CkSampleT< real, ret >::pup().
Definition at line 29 of file ckstatistics.h.
Referenced by CkSampleT< real, ret >::add(), CkSampleT< real, ret >::CkSampleT(), CkSampleT< real, ret >::getMax(), and CkSampleT< real, ret >::pup().
Definition at line 30 of file ckstatistics.h.
Referenced by CkSampleT< real, ret >::add(), CkSampleT< real, ret >::CkSampleT(), CkSampleT< real, ret >::getMean(), CkSampleT< real, ret >::getVariance(), and CkSampleT< real, ret >::pup().
Definition at line 31 of file ckstatistics.h.
Referenced by CkSampleT< real, ret >::add(), CkSampleT< real, ret >::CkSampleT(), CkSampleT< real, ret >::getRMS(), CkSampleT< real, ret >::getVariance(), and CkSampleT< real, ret >::pup().
Definition at line 32 of file ckstatistics.h.
Referenced by CkSampleT< real, ret >::add(), CkSampleT< real, ret >::CkSampleT(), CkSampleT< real, ret >::getCount(), CkSampleT< real, ret >::getMean(), CkSampleT< real, ret >::getRMS(), CkSampleT< real, ret >::getVariance(), and CkSampleT< real, ret >::pup().