$darkmode
cloe::utility::Accumulator Class Reference

#include <statistics.hpp>

Public Member Functions

void reset ()
 
void push_back (double x)
 
uint64_t count () const
 
double max () const
 
double min () const
 
double mean () const
 
double variance (bool sample=false) const
 
double std_dev (bool sample=false) const
 

Friends

void to_json (fable::Json &j, const Accumulator &a)
 

Detailed Description

The Accumulator class calculates running statistics for a series of values.

  • The storage requirements are constant.
  • Each value that is given to the accumulator updates the statistics, but is itself discarded.
  • Default constructed value is valid.

Member Function Documentation

◆ count()

uint64_t cloe::utility::Accumulator::count ( ) const
inline

Number of values accumulated.

◆ max()

double cloe::utility::Accumulator::max ( ) const
inline

Maximum value encountered.

◆ mean()

double cloe::utility::Accumulator::mean ( ) const
inline

Mean value across all values.

◆ min()

double cloe::utility::Accumulator::min ( ) const
inline

Minimum value encountered.

◆ push_back()

void cloe::utility::Accumulator::push_back ( double  x)
inline

Give the accumulator a new value to incorporate.

  • The various statistics are updated internally.
Here is the caller graph for this function:

◆ reset()

void cloe::utility::Accumulator::reset ( )
inline

Reset all values to their defaults.

  • This can be useful if you want to reset the statistics after a warm-up phase.

◆ std_dev()

double cloe::utility::Accumulator::std_dev ( bool  sample = false) const
inline

Sample or population (default) standard deviation.

  • Is derived from the variance, hence the same rules apply for whether to use sample or population mode.
Here is the call graph for this function:

◆ variance()

double cloe::utility::Accumulator::variance ( bool  sample = false) const
inline

Sample or population (default) variance.

The population variance is for approximating the true mean of a population of values, of which the series is a sample. The sample variance pertains only to the sample.

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ to_json

void to_json ( fable::Json j,
const Accumulator a 
)
friend

Writes the JSON representation into j.


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