tlx
|
Calculate running aggregate statistics: feed it with values, and it will keep the minimum, the maximum, the average, the value number, and the standard deviation is values. More...
#include <aggregate.hpp>
Public Types | |
using | Type = Type_ |
Public Member Functions | |
Aggregate ()=default | |
default constructor More... | |
Aggregate (size_t count, const double &mean, const double &nvar, const Type &min, const Type &max) noexcept | |
initializing constructor More... | |
Aggregate & | add (const Type &value) noexcept |
add a value to the running aggregation More... | |
size_t | count () const noexcept |
return number of values aggregated More... | |
const Type | sum () const |
return sum over all values aggregated More... | |
const Type | total () const |
return sum over all values aggregated More... | |
double | average () const noexcept |
return the average over all values aggregated More... | |
double | avg () const noexcept |
return the average over all values aggregated More... | |
double | mean () const noexcept |
return the average over all values aggregated More... | |
const Type & | min () const noexcept |
return minimum over all values aggregated More... | |
const Type & | max () const noexcept |
return maximum over all values aggregated More... | |
Type | span () const noexcept |
return maximum - minimum over all values aggregated More... | |
double | variance (size_t ddof=1) const |
return the variance of all values aggregated. More... | |
double | var (size_t ddof=1) const |
return the variance of all values aggregated. More... | |
double | standard_deviation (size_t ddof=1) const |
return the standard deviation of all values aggregated. More... | |
double | stdev (size_t ddof=1) const |
return the standard deviation of all values aggregated. More... | |
Aggregate | operator+ (const Aggregate &a) const noexcept |
operator + to combine two Aggregate<> More... | |
Aggregate & | operator+= (const Aggregate &a) noexcept |
operator += to combine two Aggregate<> More... | |
template<typename Archive > | |
void | serialize (Archive &archive) |
serialization method for cereal. More... | |
Private Member Functions | |
double | combine_means (const Aggregate &a) const noexcept |
combine means, check if either count is zero. fix problems with NaN More... | |
double | combine_variance (const Aggregate &other) const noexcept |
T. More... | |
Private Attributes | |
size_t | count_ |
number of values aggregated More... | |
double | mean_ |
mean of values More... | |
double | nvar_ |
approximate count * variance; stddev = sqrt(nvar / (count-1)) More... | |
Type | min_ |
minimum value More... | |
Type | max_ |
maximum value More... | |
Calculate running aggregate statistics: feed it with values, and it will keep the minimum, the maximum, the average, the value number, and the standard deviation is values.
Definition at line 39 of file aggregate.hpp.
using Type = Type_ |
Definition at line 42 of file aggregate.hpp.
|
default |
default constructor
|
inlinenoexcept |
initializing constructor
Definition at line 48 of file aggregate.hpp.
add a value to the running aggregation
Definition at line 54 of file aggregate.hpp.
|
inlinenoexcept |
return the average over all values aggregated
Definition at line 78 of file aggregate.hpp.
|
inlinenoexcept |
return the average over all values aggregated
Definition at line 81 of file aggregate.hpp.
|
inlineprivatenoexcept |
combine means, check if either count is zero. fix problems with NaN
Definition at line 157 of file aggregate.hpp.
|
inlineprivatenoexcept |
T.
Chan et al 1979, "Updating Formulae and a Pairwise Algorithm for Computing Sample Variances"
Definition at line 167 of file aggregate.hpp.
|
inlinenoexcept |
return number of values aggregated
Definition at line 68 of file aggregate.hpp.
|
inlinenoexcept |
return maximum over all values aggregated
Definition at line 90 of file aggregate.hpp.
|
inlinenoexcept |
return the average over all values aggregated
Definition at line 84 of file aggregate.hpp.
|
inlinenoexcept |
return minimum over all values aggregated
Definition at line 87 of file aggregate.hpp.
operator + to combine two Aggregate<>
Definition at line 127 of file aggregate.hpp.
operator += to combine two Aggregate<>
Definition at line 140 of file aggregate.hpp.
|
inline |
serialization method for cereal.
Definition at line 151 of file aggregate.hpp.
|
inlinenoexcept |
return maximum - minimum over all values aggregated
Definition at line 93 of file aggregate.hpp.
|
inline |
return the standard deviation of all values aggregated.
ddof = delta degrees of freedom Set to 0 if you have the entire distribution Set to 1 if you have a sample (to correct for bias)
Definition at line 116 of file aggregate.hpp.
|
inline |
return the standard deviation of all values aggregated.
ddof = delta degrees of freedom Set to 0 if you have the entire distribution Set to 1 if you have a sample (to correct for bias)
Definition at line 124 of file aggregate.hpp.
|
inline |
return sum over all values aggregated
Definition at line 72 of file aggregate.hpp.
|
inline |
return sum over all values aggregated
Definition at line 75 of file aggregate.hpp.
|
inline |
return the variance of all values aggregated.
ddof = delta degrees of freedom Set to 0 if you have the entire distribution Set to 1 if you have a sample (to correct for bias)
Definition at line 108 of file aggregate.hpp.
|
inline |
return the variance of all values aggregated.
ddof = delta degrees of freedom Set to 0 if you have the entire distribution Set to 1 if you have a sample (to correct for bias)
Definition at line 99 of file aggregate.hpp.
|
private |
number of values aggregated
Definition at line 174 of file aggregate.hpp.
|
private |
maximum value
Definition at line 186 of file aggregate.hpp.
|
private |
mean of values
Definition at line 177 of file aggregate.hpp.
|
private |
minimum value
Definition at line 183 of file aggregate.hpp.
|
private |
approximate count * variance; stddev = sqrt(nvar / (count-1))
Definition at line 180 of file aggregate.hpp.