![]() |
Elementa v8.0.0
Minimalistic library for any C++ application (C++11 and up)
|

Classes | |
| class | elementa::math::stats::Statistic< Calc > |
| A statistic, i.e., a numerical function of a sample of data. More... | |
| class | elementa::math::stats::StaPol_BaseOnInc |
| An incomplete base policy for Statistic that uses incCalc() to do calcs. More... | |
| class | elementa::math::stats::StaPol_Min |
| Policy for Statistic that calculates the minimum. More... | |
| class | elementa::math::stats::StaPol_Max |
| Policy for Statistic that calculates the maximum. More... | |
| class | elementa::math::stats::StaPol_Mean |
| Policy for Statistic that calculates the mean. More... | |
| class | elementa::math::stats::StaPol_Var |
| Policy for Statistic that calculates the variance. More... | |
| class | elementa::math::stats::StaGroup_MinMax |
| A group of statistics consisting of min and max. More... | |
| class | elementa::math::stats::StaGroup_MeanVar |
| A group of statistics consisting of mean and var. More... | |
| class | elementa::math::stats::StaGroup_MinMaxMeanVar |
| A group of statistics consisting of min, max, mean and var. More... | |
Functions | |
| virtual StaDatum | elementa::math::stats::StaPol_BaseOnInc::incCalc (StaDatum prev, StaDatum v, SampleSize n)=0 |
| StaDatum | elementa::math::stats::StaPol_Min::incCalc (StaDatum prev, StaDatum v, SampleSize n) |
| StaDatum | elementa::math::stats::StaPol_Max::incCalc (StaDatum prev, StaDatum v, SampleSize n) |
| StaDatum | elementa::math::stats::StaPol_Mean::incCalc (StaDatum prev, StaDatum v, SampleSize n) |
| elementa::math::stats::StaPol_Var::StaPol_Var (Statistic< StaPol_Mean > &meanstat) | |
| Construct the policy for using incremental calculations. More... | |
| StaDatum | elementa::math::stats::StaPol_Var::incCalc (StaDatum prev, StaDatum v, SampleSize n) |
| elementa::math::stats::Statistic< Calc >::Statistic (const Calc c) | |
| Constructor: a statistic not calculated ever. More... | |
| void | elementa::math::stats::Statistic< Calc >::reset (void) |
| Set the statistic to the previous-to-calculated state. More... | |
| bool | elementa::math::stats::Statistic< Calc >::calculated (void) const noexcept |
| Return whether the statistic has been calculated. More... | |
| StaDatum | elementa::math::stats::Statistic< Calc >::value (void) const |
| Return its current calculated value, or throw if none. More... | |
| SampleSize | elementa::math::stats::Statistic< Calc >::domainSize (void) const noexcept |
| Return the number of data that has produced the current value. More... | |
| template<class TIt > | |
| void | elementa::math::stats::StaGroup_MinMax::calculate (const TIt &first, const TIt &pastend, const GetStaDatumFun< TIt > &getdatum=getstadatum_direct< TIt >) |
| Calculate the statistic on all members of the group at once. More... | |
| void | elementa::math::stats::StaGroup_MinMax::update (StaDatum v) |
| Update statistic on all members of the group at once. More... | |
| void | elementa::math::stats::StaGroup_MinMax::reset (void) |
| Reset all statistics. More... | |
| template<class TIt > | |
| void | elementa::math::stats::StaGroup_MeanVar::calculate (const TIt &first, const TIt &pastend, const GetStaDatumFun< TIt > &getdatum=getstadatum_direct< TIt >) |
| Calculate the statistic on all members of the group at once. More... | |
| void | elementa::math::stats::StaGroup_MeanVar::update (StaDatum v) |
| Update statistic on all members of the group at once. More... | |
| void | elementa::math::stats::StaGroup_MeanVar::reset (void) |
| Reset all statistics. More... | |
| template<class TIt > | |
| void | elementa::math::stats::StaGroup_MinMaxMeanVar::calculate (const TIt &first, const TIt &pastend, const GetStaDatumFun< TIt > &getdatum=getstadatum_direct< TIt >) |
| Calculate the statistic on all members of the group at once. More... | |
| void | elementa::math::stats::StaGroup_MinMaxMeanVar::update (StaDatum v) |
| Update statistic on all members of the group at once. More... | |
| void | elementa::math::stats::StaGroup_MinMaxMeanVar::reset (void) |
| Reset all statistics. More... | |
| class elementa::math::stats::Statistic |
A statistic, i.e., a numerical function of a sample of data.
A statistic is calculated from a sample and, sometimes, can be calculated incrementally as the sample is collected.
| Calc | is a policy to calculate the statistic. It must be copy constructible and have these methods: template <class TIt>
const GetStaDatum<TIt> & getdatum)
|
Definition at line 193 of file statistic.h.
Public Member Functions | |
| Statistic (const Calc c) | |
| Constructor: a statistic not calculated ever. More... | |
| void | reset (void) |
| Set the statistic to the previous-to-calculated state. More... | |
| bool | calculated (void) const noexcept |
| Return whether the statistic has been calculated. More... | |
| StaDatum | value (void) const |
| Return its current calculated value, or throw if none. More... | |
| SampleSize | domainSize (void) const noexcept |
| Return the number of data that has produced the current value. More... | |
| StaDatum | previous (void) const |
| Return the value of the statistic previous to the current one. More... | |
| template<class TIt > | |
| StaDatum | calculate (const TIt &first, const TIt &pastend, const GetStaDatumFun< TIt > &getdatum=getstadatum_direct< TIt >) |
| Calculate the statistic on a sample and return its value. More... | |
| StaDatum | update (StaDatum v) |
| Calculate the statistic incrementally from its previous value. More... | |
| class elementa::math::stats::StaPol_BaseOnInc |
An incomplete base policy for Statistic that uses incCalc() to do calcs.
Definition at line 81 of file statistic.h.

Public Member Functions | |
| virtual StaDatum | incCalc (StaDatum prev, StaDatum v, SampleSize n)=0 |
| template<class TIt > | |
| StaDatum | calc (const TIt &first, const TIt &pastend, SampleSize &n, const GetStaDatumFun< TIt > &getdatum=getstadatum_direct< TIt >) |
| class elementa::math::stats::StaPol_Min |
Policy for Statistic that calculates the minimum.
Definition at line 97 of file statistic.h.


Public Member Functions | |
| StaDatum | incCalc (StaDatum prev, StaDatum v, SampleSize n) |
| template<class TIt > | |
| StaDatum | calc (const TIt &first, const TIt &pastend, SampleSize &n, const GetStaDatumFun< TIt > &getdatum=getstadatum_direct< TIt >) |
| class elementa::math::stats::StaPol_Max |
Policy for Statistic that calculates the maximum.
Definition at line 109 of file statistic.h.


Public Member Functions | |
| StaDatum | incCalc (StaDatum prev, StaDatum v, SampleSize n) |
| template<class TIt > | |
| StaDatum | calc (const TIt &first, const TIt &pastend, SampleSize &n, const GetStaDatumFun< TIt > &getdatum=getstadatum_direct< TIt >) |
| class elementa::math::stats::StaPol_Mean |
Policy for Statistic that calculates the mean.
Definition at line 121 of file statistic.h.
Public Member Functions | |
| StaDatum | incCalc (StaDatum prev, StaDatum v, SampleSize n) |
| template<class TIt > | |
| StaDatum | calc (const TIt &first, const TIt &pastend, SampleSize &n, const GetStaDatumFun< TIt > &getdatum=getstadatum_direct< TIt >) |
| class elementa::math::stats::StaPol_Var |
Policy for Statistic that calculates the variance.
This policy needs the existence of a Statistic with StaPol_Mean policy that is updated previously to using this one.
Definition at line 142 of file statistic.h.
Public Member Functions | |
| StaPol_Var (Statistic< StaPol_Mean > &meanstat) | |
| Construct the policy for using incremental calculations. More... | |
| StaDatum | incCalc (StaDatum prev, StaDatum v, SampleSize n) |
| template<class TIt > | |
| StaDatum | calc (const TIt &first, const TIt &pastend, SampleSize &n, const GetStaDatumFun< TIt > &getdatum=getstadatum_direct< TIt >) |
| class elementa::math::stats::StaGroup_MinMax |
A group of statistics consisting of min and max.
Definition at line 251 of file statistic.h.

Public Attributes | |
| Statistic< StaPol_Min > | stamin {StaPol_Min{}} |
| The min statistic. More... | |
| Statistic< StaPol_Max > | stamax {StaPol_Max{}} |
| The max statistic. More... | |
Public Member Functions | |
| template<class TIt > | |
| void | calculate (const TIt &first, const TIt &pastend, const GetStaDatumFun< TIt > &getdatum=getstadatum_direct< TIt >) |
| Calculate the statistic on all members of the group at once. More... | |
| void | update (StaDatum v) |
| Update statistic on all members of the group at once. More... | |
| void | reset (void) |
| Reset all statistics. More... | |
| class elementa::math::stats::StaGroup_MeanVar |
A group of statistics consisting of mean and var.
Definition at line 277 of file statistic.h.

Public Attributes | |
| Statistic< StaPol_Mean > | stamean {StaPol_Mean{}} |
| The mean statistic. More... | |
| Statistic< StaPol_Var > | stavar {StaPol_Var{stamean}} |
| The var statistic. More... | |
Public Member Functions | |
| template<class TIt > | |
| void | calculate (const TIt &first, const TIt &pastend, const GetStaDatumFun< TIt > &getdatum=getstadatum_direct< TIt >) |
| Calculate the statistic on all members of the group at once. More... | |
| void | update (StaDatum v) |
| Update statistic on all members of the group at once. More... | |
| void | reset (void) |
| Reset all statistics. More... | |
| class elementa::math::stats::StaGroup_MinMaxMeanVar |
A group of statistics consisting of min, max, mean and var.
Definition at line 303 of file statistic.h.

Public Attributes | |
| Statistic< StaPol_Min > | stamin {StaPol_Min{}} |
| The min statistic. More... | |
| Statistic< StaPol_Max > | stamax {StaPol_Max{}} |
| The max statistic. More... | |
| Statistic< StaPol_Mean > | stamean {StaPol_Mean{}} |
| The mean statistic. More... | |
| Statistic< StaPol_Var > | stavar {StaPol_Var{stamean}} |
| The var statistic. More... | |
Public Member Functions | |
| template<class TIt > | |
| void | calculate (const TIt &first, const TIt &pastend, const GetStaDatumFun< TIt > &getdatum=getstadatum_direct< TIt >) |
| Calculate the statistic on all members of the group at once. More... | |
| void | update (StaDatum v) |
| Update statistic on all members of the group at once. More... | |
| void | reset (void) |
| Reset all statistics. More... | |
| using elementa::math::stats::SampleSize = typedef size_t |
#include <elementa/math/stats/statistic.h>
The number of elements in a sample.
Definition at line 51 of file statistic.h.
| using elementa::math::stats::StaDatum = typedef double |
#include <elementa/math/stats/statistic.h>
Type of data to allow for statistic calculation.
Definition at line 54 of file statistic.h.
| using elementa::math::stats::GetStaDatumFun = typedef std::function< StaDatum(const DatumIterator &) > |
#include <elementa/math/stats/statistic.h>
A function type that gets a datum from an iterator.
Definition at line 58 of file statistic.h.
|
constexpr |
#include <elementa/math/stats/statistic.h>
A simple GetStaDatumFun that gets directly the datum from the iterator.
Definition at line 62 of file statistic.h.
| StaDatum elementa::math::stats::StaPol_BaseOnInc::calc | ( | const TIt & | first, |
| const TIt & | pastend, | ||
| SampleSize & | n, | ||
| const GetStaDatumFun< TIt > & | getdatum = getstadatum_direct<TIt> |
||
| ) |
#include <elementa/math/stats/statistic.h>
Definition at line 397 of file statistic.h.
|
inlinevirtual |
#include <elementa/math/stats/statistic.h>
Implements elementa::math::stats::StaPol_BaseOnInc.
Definition at line 101 of file statistic.h.
|
inlinevirtual |
#include <elementa/math/stats/statistic.h>
Implements elementa::math::stats::StaPol_BaseOnInc.
Definition at line 113 of file statistic.h.
| StaDatum elementa::math::stats::StaPol_Mean::calc | ( | const TIt & | first, |
| const TIt & | pastend, | ||
| SampleSize & | n, | ||
| const GetStaDatumFun< TIt > & | getdatum = getstadatum_direct<TIt> |
||
| ) |
#include <elementa/math/stats/statistic.h>
Definition at line 422 of file statistic.h.
|
inline |
#include <elementa/math/stats/statistic.h>
Definition at line 130 of file statistic.h.
|
inline |
#include <elementa/math/stats/statistic.h>
Construct the policy for using incremental calculations.
meanstat must outlive this object, since a reference to it is held.
Definition at line 148 of file statistic.h.
| StaDatum elementa::math::stats::StaPol_Var::calc | ( | const TIt & | first, |
| const TIt & | pastend, | ||
| SampleSize & | n, | ||
| const GetStaDatumFun< TIt > & | getdatum = getstadatum_direct<TIt> |
||
| ) |
#include <elementa/math/stats/statistic.h>
Definition at line 446 of file statistic.h.
|
inline |
#include <elementa/math/stats/statistic.h>
Constructor: a statistic not calculated ever.
Definition at line 198 of file statistic.h.
References elementa::math::stats::Statistic< Calc >::reset().
|
inline |
#include <elementa/math/stats/statistic.h>
Set the statistic to the previous-to-calculated state.
Definition at line 202 of file statistic.h.
Referenced by elementa::math::stats::Statistic< Calc >::Statistic().
|
inlinenoexcept |
#include <elementa/math/stats/statistic.h>
Return whether the statistic has been calculated.
Definition at line 205 of file statistic.h.
|
inline |
#include <elementa/math/stats/statistic.h>
Return its current calculated value, or throw if none.
Definition at line 208 of file statistic.h.
| StaDatum elementa::math::stats::Statistic< Calc >::previous | ( | void | ) | const |
#include <elementa/math/stats/statistic.h>
Return the value of the statistic previous to the current one.
Only has meaning if the statistic is being calculated incrementally. Throw if none.
Definition at line 349 of file statistic.h.
References ELE_CODE_INVSTATE.
|
inlinenoexcept |
#include <elementa/math/stats/statistic.h>
Return the number of data that has produced the current value.
If it is not calculated, return 0.
Definition at line 217 of file statistic.h.
| StaDatum elementa::math::stats::Statistic< Calc >::calculate | ( | const TIt & | first, |
| const TIt & | pastend, | ||
| const GetStaDatumFun< TIt > & | getdatum = getstadatum_direct<TIt> |
||
| ) |
#include <elementa/math/stats/statistic.h>
Calculate the statistic on a sample and return its value.
Definition at line 358 of file statistic.h.
References ELE_CODE_INVARG.
| StaDatum elementa::math::stats::Statistic< Calc >::update | ( | StaDatum | v | ) |
#include <elementa/math/stats/statistic.h>
Calculate the statistic incrementally from its previous value.
In the first call, return v.
Definition at line 370 of file statistic.h.
References ELE_CODE_INVSTATE.
|
inline |
#include <elementa/math/stats/statistic.h>
Calculate the statistic on all members of the group at once.
Definition at line 260 of file statistic.h.
References elementa::math::stats::StaGroup_MinMax::stamax, and elementa::math::stats::StaGroup_MinMax::stamin.
|
inline |
#include <elementa/math/stats/statistic.h>
Update statistic on all members of the group at once.
Definition at line 267 of file statistic.h.
References elementa::math::stats::StaGroup_MinMax::stamax, and elementa::math::stats::StaGroup_MinMax::stamin.
|
inline |
#include <elementa/math/stats/statistic.h>
Reset all statistics.
Definition at line 270 of file statistic.h.
References elementa::math::stats::StaGroup_MinMax::stamax, and elementa::math::stats::StaGroup_MinMax::stamin.
|
inline |
#include <elementa/math/stats/statistic.h>
Calculate the statistic on all members of the group at once.
Definition at line 286 of file statistic.h.
References elementa::math::stats::StaGroup_MeanVar::stamean, and elementa::math::stats::StaGroup_MeanVar::stavar.
|
inline |
#include <elementa/math/stats/statistic.h>
Update statistic on all members of the group at once.
Definition at line 293 of file statistic.h.
References elementa::math::stats::StaGroup_MeanVar::stamean, and elementa::math::stats::StaGroup_MeanVar::stavar.
|
inline |
#include <elementa/math/stats/statistic.h>
Reset all statistics.
Definition at line 296 of file statistic.h.
References elementa::math::stats::StaGroup_MeanVar::stamean, and elementa::math::stats::StaGroup_MeanVar::stavar.
|
inline |
#include <elementa/math/stats/statistic.h>
Calculate the statistic on all members of the group at once.
Definition at line 314 of file statistic.h.
References elementa::math::stats::StaGroup_MinMaxMeanVar::stamax, elementa::math::stats::StaGroup_MinMaxMeanVar::stamean, elementa::math::stats::StaGroup_MinMaxMeanVar::stamin, and elementa::math::stats::StaGroup_MinMaxMeanVar::stavar.
|
inline |
#include <elementa/math/stats/statistic.h>
Update statistic on all members of the group at once.
Definition at line 323 of file statistic.h.
References elementa::math::stats::StaGroup_MinMaxMeanVar::stamax, elementa::math::stats::StaGroup_MinMaxMeanVar::stamean, elementa::math::stats::StaGroup_MinMaxMeanVar::stamin, and elementa::math::stats::StaGroup_MinMaxMeanVar::stavar.
|
inline |
#include <elementa/math/stats/statistic.h>
Reset all statistics.
Definition at line 328 of file statistic.h.
References elementa::math::stats::StaGroup_MinMaxMeanVar::stamax, elementa::math::stats::StaGroup_MinMaxMeanVar::stamean, elementa::math::stats::StaGroup_MinMaxMeanVar::stamin, and elementa::math::stats::StaGroup_MinMaxMeanVar::stavar.
| Statistic<StaPol_Min> elementa::math::stats::StaGroup_MinMax::stamin {StaPol_Min{}} |
The min statistic.
Definition at line 255 of file statistic.h.
Referenced by elementa::math::stats::StaGroup_MinMax::calculate(), elementa::math::stats::StaGroup_MinMax::reset(), and elementa::math::stats::StaGroup_MinMax::update().
| Statistic<StaPol_Max> elementa::math::stats::StaGroup_MinMax::stamax {StaPol_Max{}} |
The max statistic.
Definition at line 256 of file statistic.h.
Referenced by elementa::math::stats::StaGroup_MinMax::calculate(), elementa::math::stats::StaGroup_MinMax::reset(), and elementa::math::stats::StaGroup_MinMax::update().
| Statistic<StaPol_Mean> elementa::math::stats::StaGroup_MeanVar::stamean {StaPol_Mean{}} |
The mean statistic.
Definition at line 281 of file statistic.h.
Referenced by elementa::math::stats::StaGroup_MeanVar::calculate(), elementa::math::stats::StaGroup_MeanVar::reset(), and elementa::math::stats::StaGroup_MeanVar::update().
| Statistic<StaPol_Var> elementa::math::stats::StaGroup_MeanVar::stavar {StaPol_Var{stamean}} |
The var statistic.
Definition at line 282 of file statistic.h.
Referenced by elementa::math::stats::StaGroup_MeanVar::calculate(), elementa::math::stats::StaGroup_MeanVar::reset(), and elementa::math::stats::StaGroup_MeanVar::update().
| Statistic<StaPol_Min> elementa::math::stats::StaGroup_MinMaxMeanVar::stamin {StaPol_Min{}} |
The min statistic.
Definition at line 307 of file statistic.h.
Referenced by elementa::math::stats::StaGroup_MinMaxMeanVar::calculate(), elementa::math::stats::StaGroup_MinMaxMeanVar::reset(), and elementa::math::stats::StaGroup_MinMaxMeanVar::update().
| Statistic<StaPol_Max> elementa::math::stats::StaGroup_MinMaxMeanVar::stamax {StaPol_Max{}} |
The max statistic.
Definition at line 308 of file statistic.h.
Referenced by elementa::math::stats::StaGroup_MinMaxMeanVar::calculate(), elementa::math::stats::StaGroup_MinMaxMeanVar::reset(), and elementa::math::stats::StaGroup_MinMaxMeanVar::update().
| Statistic<StaPol_Mean> elementa::math::stats::StaGroup_MinMaxMeanVar::stamean {StaPol_Mean{}} |
The mean statistic.
Definition at line 309 of file statistic.h.
Referenced by elementa::math::stats::StaGroup_MinMaxMeanVar::calculate(), elementa::math::stats::StaGroup_MinMaxMeanVar::reset(), and elementa::math::stats::StaGroup_MinMaxMeanVar::update().
| Statistic<StaPol_Var> elementa::math::stats::StaGroup_MinMaxMeanVar::stavar {StaPol_Var{stamean}} |
The var statistic.
Definition at line 310 of file statistic.h.
Referenced by elementa::math::stats::StaGroup_MinMaxMeanVar::calculate(), elementa::math::stats::StaGroup_MinMaxMeanVar::reset(), and elementa::math::stats::StaGroup_MinMaxMeanVar::update().