Visual Computing Library
Loading...
Searching...
No Matches
vcl::Distribution< Scalar > Class Template Reference

The Distribution class allows to collect a set of values and then compute some statistics like average, variance, standardDeviation, and percentiles. More...

#include <vclib/math/distribution.h>

Public Member Functions

 Distribution ()=default
 Creates an empty distribution.
 
void clear ()
 Clears the distribution, removing all its values.
 
void add (Scalar v)
 Adds a value to the distribution.
 
Scalar min () const
 Returns the minimum value of the distribution.
 
Scalar max () const
 Returns the maximum value of the distribution.
 
uint size () const
 Returns the number of values of the distribution.
 
Scalar sum () const
 Returns the sum of the values of the distribution.
 
Scalar average () const
 Returns the average of the values of the distribution.
 
Scalar rootMeanSquare () const
 Returns the root mean square of the values of the distribution.
 
Scalar variance () const
 Returns the variance of the values of the distribution.
 
Scalar standardDeviation () const
 Returns the standard deviation of the values of the distribution.
 
Scalar percentile (Scalar perc) const
 Returns the perc percentile of the values of the distribution.
 

Private Attributes

std::set< Scalar > mSet
 
Scalar mMin = std::numeric_limits<Scalar>::max()
 
Scalar mMax = std::numeric_limits<Scalar>::lowest()
 
Scalar mSum = 0
 
Scalar mSqrdSum = 0
 
Scalar mAvg = 0
 
Scalar mSqrdAvg = 0
 
Scalar mRMS = 0
 

Detailed Description

template<typename Scalar>
class vcl::Distribution< Scalar >

The Distribution class allows to collect a set of values and then compute some statistics like average, variance, standardDeviation, and percentiles.

Member Function Documentation

◆ add()

template<typename Scalar >
void vcl::Distribution< Scalar >::add ( Scalar  v)
inline

Adds a value to the distribution.

Parameters
[in]vthe value to add.

◆ average()

template<typename Scalar >
Scalar vcl::Distribution< Scalar >::average ( ) const
inline

Returns the average of the values of the distribution.

Returns
The average of the distribution values.

◆ max()

template<typename Scalar >
Scalar vcl::Distribution< Scalar >::max ( ) const
inline

Returns the maximum value of the distribution.

If the distribution is empty, returns std::numeric_limits::lowest().

Returns
The maximum of the distribution values.

◆ min()

template<typename Scalar >
Scalar vcl::Distribution< Scalar >::min ( ) const
inline

Returns the minimum value of the distribution.

If the distribution is empty, returns std::numeric_limits::max().

Returns
The minimum of the distribution values.

◆ percentile()

template<typename Scalar >
Scalar vcl::Distribution< Scalar >::percentile ( Scalar  perc) const
inline

Returns the perc percentile of the values of the distribution.

Parameters
[in]percthe desired percentile. Must be a value between 0 and 1.
Returns
The value of the distribution in the given percentile.

◆ rootMeanSquare()

template<typename Scalar >
Scalar vcl::Distribution< Scalar >::rootMeanSquare ( ) const
inline

Returns the root mean square of the values of the distribution.

Returns
The root mean square of the distribution values.

◆ size()

template<typename Scalar >
uint vcl::Distribution< Scalar >::size ( ) const
inline

Returns the number of values of the distribution.

Returns
The size of the distribution.

◆ standardDeviation()

template<typename Scalar >
Scalar vcl::Distribution< Scalar >::standardDeviation ( ) const
inline

Returns the standard deviation of the values of the distribution.

Returns
The standard deviation of the distribution values.

◆ sum()

template<typename Scalar >
Scalar vcl::Distribution< Scalar >::sum ( ) const
inline

Returns the sum of the values of the distribution.

Returns
The sum of the distribution values.

◆ variance()

template<typename Scalar >
Scalar vcl::Distribution< Scalar >::variance ( ) const
inline

Returns the variance of the values of the distribution.

Returns
The variance of the distribution values.

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