TSDuck v3.46-4930
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches
ts::SingleDataStatistics< NUMBER, DEFAULT_FLOAT, class > Class Template Reference

#include <tsSingleDataStatistics.h>

Public Types

using FLOAT = typename std::conditional<std::is_floating_point<NUMBER>::value, NUMBER, DEFAULT_FLOAT>::type
using SIGNED = typename ts::make_signed<NUMBER>::type

Public Member Functions

size_t count () const
void feed (NUMBER value)
NUMBER maximum () const
FLOAT mean () const
NUMBER meanRound () const
UString meanString (size_t width=0, size_t precision=2) const
NUMBER minimum () const
void reset ()
FLOAT standardDeviation () const
UString standardDeviationString (size_t width=0, size_t precision=2) const
FLOAT variance () const
UString varianceString (size_t width=0, size_t precision=2) const

Detailed Description

template<typename NUMBER, typename DEFAULT_FLOAT = double, class = void>
class ts::SingleDataStatistics< NUMBER, DEFAULT_FLOAT, class >

Statistics over a single set of data (integer or floating point).

Template Parameters
NUMBERInteger or floating point data type. A specialization is available for std::chrono::duration types.
DEFAULT_FLOATDefault floating point type for finer results. Ignored if NUMBER is a floating point type.

Member Typedef Documentation

◆ SIGNED

template<typename NUMBER, typename DEFAULT_FLOAT = double, class = void>
using ts::SingleDataStatistics< NUMBER, DEFAULT_FLOAT, class >::SIGNED = typename ts::make_signed<NUMBER>::type

The signed type for NUMBER.

◆ FLOAT

template<typename NUMBER, typename DEFAULT_FLOAT = double, class = void>
using ts::SingleDataStatistics< NUMBER, DEFAULT_FLOAT, class >::FLOAT = typename std::conditional<std::is_floating_point<NUMBER>::value, NUMBER, DEFAULT_FLOAT>::type

The floating-point type for NUMBER finer results.

Member Function Documentation

◆ reset()

template<typename NUMBER, typename DEFAULT_FLOAT, class N>
void ts::SingleDataStatistics< NUMBER, DEFAULT_FLOAT, N >::reset ( )

Reset the statistics collection.

◆ feed()

template<typename NUMBER, typename DEFAULT_FLOAT, class N>
void ts::SingleDataStatistics< NUMBER, DEFAULT_FLOAT, N >::feed ( NUMBER value)

Accumulate one more data sample.

Parameters
[in]valueData sample.

◆ count()

template<typename NUMBER, typename DEFAULT_FLOAT = double, class = void>
size_t ts::SingleDataStatistics< NUMBER, DEFAULT_FLOAT, class >::count ( ) const
inline

Get the number of accumulated samples.

Returns
The number of accumulated samples.

◆ minimum()

template<typename NUMBER, typename DEFAULT_FLOAT = double, class = void>
NUMBER ts::SingleDataStatistics< NUMBER, DEFAULT_FLOAT, class >::minimum ( ) const
inline

Get the minimum value of all accumulated samples.

Returns
The minimum value.

◆ maximum()

template<typename NUMBER, typename DEFAULT_FLOAT = double, class = void>
NUMBER ts::SingleDataStatistics< NUMBER, DEFAULT_FLOAT, class >::maximum ( ) const
inline

Get the maximum value of all accumulated samples.

Returns
The maximum value.

◆ mean()

template<typename NUMBER, typename DEFAULT_FLOAT, class N>
ts::SingleDataStatistics< NUMBER, DEFAULT_FLOAT, N >::FLOAT ts::SingleDataStatistics< NUMBER, DEFAULT_FLOAT, N >::mean ( ) const

Get the mean value of all accumulated samples.

Returns
The mean value. When NUMBER is an integer type, the returned value is from the FLOAT floating-point type.

◆ meanRound()

template<typename NUMBER, typename DEFAULT_FLOAT = double, class = void>
NUMBER ts::SingleDataStatistics< NUMBER, DEFAULT_FLOAT, class >::meanRound ( ) const
inline

Get the mean value of all accumulated samples, rounded to the nearest integer.

Returns
The mean value, rounded to the nearest integer.

◆ variance()

template<typename NUMBER, typename DEFAULT_FLOAT, class N>
ts::SingleDataStatistics< NUMBER, DEFAULT_FLOAT, N >::FLOAT ts::SingleDataStatistics< NUMBER, DEFAULT_FLOAT, N >::variance ( ) const

Get the variance of all accumulated samples.

Returns
The variance. When NUMBER is an integer type, the returned value is from the FLOAT floating-point type.

◆ standardDeviation()

template<typename NUMBER, typename DEFAULT_FLOAT = double, class = void>
FLOAT ts::SingleDataStatistics< NUMBER, DEFAULT_FLOAT, class >::standardDeviation ( ) const
inline

Get the standard deviation of all accumulated samples.

Returns
The standard deviation. When NUMBER is an integer type, the returned value is from the FLOAT floating-point type.

◆ meanString()

template<typename NUMBER, typename DEFAULT_FLOAT, class N>
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.

Parameters
[in]widthMinimum width of the string, left-padded with spaces.
[in]precisionNumber of decimal digits.
Returns
The mean value as a string.

◆ varianceString()

template<typename NUMBER, typename DEFAULT_FLOAT, class N>
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.

Parameters
[in]widthMinimum width of the string, left-padded with spaces.
[in]precisionNumber of decimal digits.
Returns
The variance as a string.

◆ standardDeviationString()

template<typename NUMBER, typename DEFAULT_FLOAT, class N>
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.

Parameters
[in]widthMinimum width of the string, left-padded with spaces.
[in]precisionNumber of decimal digits.
Returns
The standard deviation as a string.

The documentation for this class was generated from the following file: