|
Statistics
1.0.0
A C++17 for profiling and constant time statistical calculation
|
Keeps a simple average of a series of measurements. More...
#include <statistics.h>
Public Types | |
| using | T2 = decltype(T{} *T{}) |
Public Member Functions | |
| Statistics () | |
| Default Constructor. | |
| Statistics (T measurement) | |
| Constructor. More... | |
| Statistics (std::initializer_list< T > init) | |
| Construct from initializer list. More... | |
| template<class InputIt > | |
| Statistics (InputIt first, InputIt last) | |
| Constructor from input iterators. More... | |
| void | clear () noexcept |
| size_t | count () const noexcept |
| Measurement count. More... | |
| Statistics & | insert (const T &measurement) noexcept |
| Insert a measurement into the population. More... | |
| template<class InputIt > | |
| Statistics & | insert (const InputIt &first, const InputIt &last) noexcept |
| Insert measurements into the population. More... | |
| T | mean () const noexcept |
| Value of the mean. More... | |
| T | min () const noexcept |
| Returns minimum sampled value. More... | |
| T | max () const noexcept |
| Returns maximum sampled value. More... | |
| T | sum () const noexcept |
| Sum of the samples. More... | |
| T2 | sumOfSquares () const noexcept |
| Returns the sum of squares of all measurements. More... | |
| auto | variance () const noexcept |
| Calculates the variance of the population. More... | |
| T | standardDeviation () const noexcept |
| Calculates the standard deviation of the population. More... | |
| Statistics & | operator+= (const T &measurement) noexcept |
| Returns the average updated with the given measurement. More... | |
| Statistics & | operator+= (const Statistics &rhs) noexcept |
| Returns the average updated with the given measurement. More... | |
Friends | |
| template<class U > | |
| Statistics< U > | operator+ (const Statistics< U > &lhs, const T &rhs) noexcept |
| template<class U > | |
| Statistics< U > | operator+ (const Statistics< U > &lhs, const Statistics< U > &rhs) noexcept |
| template<class U > | |
| bool | operator== (const Statistics< U > &lhs, const Statistics< U > &rhs) noexcept |
| template<class U > | |
| bool | operator!= (const Statistics< U > &lhs, const Statistics< U > &rhs) noexcept |
| template<class U > | |
| bool | operator< (const Statistics< U > &lhs, const Statistics< U > &rhs) noexcept |
| template<class U > | |
| bool | operator<= (const Statistics< U > &lhs, const Statistics< U > &rhs) noexcept |
| template<class U > | |
| bool | operator> (const Statistics< U > &lhs, const Statistics< U > &rhs) noexcept |
| template<class U > | |
| bool | operator>= (const Statistics< U > &lhs, const Statistics< U > &rhs) noexcept |
Keeps a simple average of a series of measurements.
|
inlineexplicit |
Constructor.
O(1) complexity
| [in] | measurement | Initial measurement |
|
inline |
Construct from initializer list.
O(N) complexity.
| [in] | init | initializer list containing the population |
|
inlineexplicit |
Constructor from input iterators.
O(1) complexity
| [in] | seed | Starting value for the average. Defaults to 0. |
|
inlinenoexcept |
Measurement count.
O(1) complexity.
|
inlinenoexcept |
Insert measurements into the population.
O(N) complexity.
| [in] | first | begin iterator |
| [in] | last | end iterator |
this
|
inlinenoexcept |
Insert a measurement into the population.
O(1) complexity. Equivalent to +=.
| [in] | measurement | Measurement to add to the population |
this
|
inlinenoexcept |
Returns maximum sampled value.
O(1) complexity.
|
inlinenoexcept |
Value of the mean.
O(1) complexity. Returns 0 if no measurements have been taken.
|
inlinenoexcept |
Returns minimum sampled value.
O(1) complexity.
|
inlinenoexcept |
Returns the average updated with the given measurement.
O(1) complexity.
| [in] | measurement | value to add to the average. |
|
inlinenoexcept |
Returns the average updated with the given measurement.
O(1) complexity.
| [in] | measurement | value to add to the average. |
|
inlinenoexcept |
Calculates the standard deviation of the population.
O(1) complexity.
|
inlinenoexcept |
Sum of the samples.
O(1) complexity.
|
inlinenoexcept |
Returns the sum of squares of all measurements.
O(1) complexity.
|
inlinenoexcept |
Calculates the variance of the population.
O(1) complexity.