11 #ifndef TLX_MATH_AGGREGATE_HEADER 12 #define TLX_MATH_AGGREGATE_HEADER 30 template <
typename Type_>
92 if (
count_ <= 1)
return 0.0;
100 double var(
size_t ddof = 1)
const {
142 template <
typename Archive>
161 return nvar_ + other.nvar_ + (delta *
delta) *
185 #endif // !TLX_MATH_AGGREGATE_HEADER double combine_variance(const Aggregate &other) const noexcept
static uint_pair max()
return an uint_pair instance containing the largest value possible
Aggregate & add(const Type &value) noexcept
add a value to the running aggregation
Type span() const noexcept
return maximum - minimum over all values aggregated
static constexpr double delta
double stdev(size_t ddof=1) const
Aggregate & operator+=(const Aggregate &a) noexcept
operator += to combine two Aggregate<>
double var(size_t ddof=1) const
double mean() const noexcept
return the average over all values aggregated
Aggregate()=default
default constructor
const Type sum() const
return sum over all values aggregated
double standard_deviation(size_t ddof=1) const
void serialize(Archive &archive)
serialization method for cereal.
double mean_
mean of values
Aggregate(size_t count, const double &mean, const double &nvar, const Type &min, const Type &max) noexcept
initializing constructor
const Type & min() const noexcept
return minimum over all values aggregated
double avg() const noexcept
return the average over all values aggregated
static uint_pair min()
return an uint_pair instance containing the smallest value possible
const Type total() const
return sum over all values aggregated
size_t count_
number of values aggregated
double average() const noexcept
return the average over all values aggregated
double variance(size_t ddof=1) const
const Type & max() const noexcept
return maximum over all values aggregated
size_t count() const noexcept
return number of values aggregated
double combine_means(const Aggregate &a) const noexcept
combine means, check if either count is zero. fix problems with NaN
Aggregate operator+(const Aggregate &a) const noexcept
operator + to combine two Aggregate<>
double nvar_
approximate count * variance; stddev = sqrt(nvar / (count-1))
Calculate running aggregate statistics: feed it with values, and it will keep the minimum...