TSDuck v3.40-4033
MPEG Transport Stream Toolkit
|
Statistics over a single set of data (integer or floating point). More...
#include <tsSingleDataStatistics.h>
Public Types | |
using | FLOAT = typename std::conditional< std::is_floating_point< NUMBER >::value, NUMBER, DEFAULT_FLOAT >::type |
The floating-point type for NUMBER finer results. | |
using | SIGNED = typename ts::make_signed< NUMBER >::type |
The signed type for NUMBER. | |
Public Member Functions | |
size_t | count () const |
Get the number of accumulated samples. | |
void | feed (NUMBER value) |
Accumulate one more data sample. | |
NUMBER | maximum () const |
Get the maximum value of all accumulated samples. | |
FLOAT | mean () const |
Get the mean value of all accumulated samples. | |
NUMBER | meanRound () const |
Get the mean value of all accumulated samples, rounded to the nearest integer. | |
UString | meanString (size_t width=0, size_t precision=2) const |
Get the mean value of all accumulated samples as a string. | |
NUMBER | minimum () const |
Get the minimum value of all accumulated samples. | |
void | reset () |
Reset the statistics collection. | |
FLOAT | standardDeviation () const |
Get the standard deviation of all accumulated samples. | |
UString | standardDeviationString (size_t width=0, size_t precision=2) const |
Get the standard deviation of all accumulated samples as a string. | |
FLOAT | variance () const |
Get the variance of all accumulated samples. | |
UString | varianceString (size_t width=0, size_t precision=2) const |
Get the variance of all accumulated samples as a string. | |
Statistics over a single set of data (integer or floating point).
NUMBER | Integer or floating point data type. A specialization is available for std::chrono::duration types. |
DEFAULT_FLOAT | Default floating point type for finer results. Ignored if NUMBER is a floating point type. |
void ts::SingleDataStatistics< NUMBER, DEFAULT_FLOAT, N >::feed | ( | NUMBER | value | ) |
Accumulate one more data sample.
[in] | value | Data sample. |
|
inline |
Get the number of accumulated samples.
|
inline |
Get the minimum value of all accumulated samples.
|
inline |
Get the maximum value of all accumulated samples.
ts::SingleDataStatistics< NUMBER, DEFAULT_FLOAT, N >::FLOAT ts::SingleDataStatistics< NUMBER, DEFAULT_FLOAT, N >::mean | ( | ) | const |
Get the mean value of all accumulated samples.
|
inline |
Get the mean value of all accumulated samples, rounded to the nearest integer.
ts::SingleDataStatistics< NUMBER, DEFAULT_FLOAT, N >::FLOAT ts::SingleDataStatistics< NUMBER, DEFAULT_FLOAT, N >::variance | ( | ) | const |
Get the variance of all accumulated samples.
|
inline |
Get the standard deviation of all accumulated samples.
ts::UString ts::SingleDataStatistics< NUMBER, DEFAULT_FLOAT, N >::meanString | ( | size_t | width = 0 , |
size_t | precision = 2 |
||
) | const |
Get the mean value of all accumulated samples as a string.
[in] | width | Minimum width of the string, left-padded with spaces. |
[in] | precision | Number of decimal digits. |
ts::UString ts::SingleDataStatistics< NUMBER, DEFAULT_FLOAT, N >::varianceString | ( | size_t | width = 0 , |
size_t | precision = 2 |
||
) | const |
Get the variance of all accumulated samples as a string.
[in] | width | Minimum width of the string, left-padded with spaces. |
[in] | precision | Number of decimal digits. |
ts::UString ts::SingleDataStatistics< NUMBER, DEFAULT_FLOAT, N >::standardDeviationString | ( | size_t | width = 0 , |
size_t | precision = 2 |
||
) | const |
Get the standard deviation of all accumulated samples as a string.
[in] | width | Minimum width of the string, left-padded with spaces. |
[in] | precision | Number of decimal digits. |