PPL Logo

CkSampleT< real, ret > Class Template Reference

CkSampleT represents a statistical "sample" of some data values. More...

#include <ckstatistics.h>

Collaboration diagram for CkSampleT< real, ret >:

Collaboration graph
[legend]

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)

Detailed Description

template<class real, class ret>
class CkSampleT< real, ret >

CkSampleT represents a statistical "sample" of some data values.

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.


Constructor & Destructor Documentation

template<class real, class ret>
CkSampleT< real, ret >::CkSampleT ( void   )  [inline]


Member Function Documentation

template<class real, class ret>
void CkSampleT< real, ret >::add ( real  r  )  [inline]

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.

template<class real, class ret>
void CkSampleT< real, ret >::operator+= ( real  r  )  [inline]

Shorthand for add function.

Definition at line 52 of file ckstatistics.h.

template<class real, class ret>
void CkSampleT< real, ret >::add ( const CkSampleT< real, ret > &  errs  )  [inline]

template<class real, class ret>
ret CkSampleT< real, ret >::getMean ( void   )  const [inline]

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().

Here is the caller graph for this function:

template<class real, class ret>
ret CkSampleT< real, ret >::getVariance ( void   )  const [inline]

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().

Here is the caller graph for this function:

template<class real, class ret>
ret CkSampleT< real, ret >::getStddev ( void   )  const [inline]

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().

Here is the call graph for this function:

Here is the caller graph for this function:

template<class real, class ret>
real CkSampleT< real, ret >::getMin ( void   )  const [inline]

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().

Here is the caller graph for this function:

template<class real, class ret>
real CkSampleT< real, ret >::getMax ( void   )  const [inline]

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().

Here is the caller graph for this function:

template<class real, class ret>
int CkSampleT< real, ret >::getCount ( void   )  const [inline]

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().

Here is the caller graph for this function:

template<class real, class ret>
ret CkSampleT< real, ret >::getRMS ( void   )  const [inline]

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.

template<class real, class ret>
void CkSampleT< real, ret >::print ( FILE *  dest  )  [inline]

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().

Here is the call graph for this function:

template<class real, class ret>
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().

Here is the call graph for this function:

template<class real, class ret>
void CkSampleT< real, ret >::print ( void   )  [inline]

Print a textual description of this sample to stdout.

Definition at line 122 of file ckstatistics.h.

template<class real, class ret>
void CkSampleT< real, ret >::pup ( PUP::er p  )  [inline]

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.


Friends And Related Function Documentation

template<class real, class ret>
void operator| ( PUP::er p,
CkSampleT< real, ret > &  s 
) [friend]

Definition at line 130 of file ckstatistics.h.


Field Documentation

template<class real, class ret>
real CkSampleT< real, ret >::lo [private]

template<class real, class ret>
real CkSampleT< real, ret >::hi [private]

template<class real, class ret>
ret CkSampleT< real, ret >::sum [private]

template<class real, class ret>
ret CkSampleT< real, ret >::sq [private]

template<class real, class ret>
int CkSampleT< real, ret >::n [private]


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

Generated on Mon Sep 21 08:21:34 2020 for Charm++ by  doxygen 1.5.5