OpenVDB  9.0.1
Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Attributes | List of all members
Stats< ValueT, 1 > Class Template Reference

This class computes statistics (minimum value, maximum value, mean, variance and standard deviation) of a population of floating-point values. More...

#include <nanovdb/util/GridStats.h>

Inherits Extrema< ValueT, 1 >.

Public Types

using ValueType = ValueT
 

Public Member Functions

 Stats ()
 
Statsadd (const ValueT &val)
 Add a single sample. More...
 
Statsadd (const ValueT &val, uint64_t n)
 Add n samples with constant value val. More...
 
Statsadd (const Stats &other)
 Add the samples from the other Stats instance. More...
 
size_t size () const
 
double avg () const
 Return the arithmetic mean, i.e. average, value. More...
 
double mean () const
 Return the arithmetic mean, i.e. average, value. More...
 
double var () const
 Return the population variance. More...
 
double variance () const
 Return the population variance. More...
 
double std () const
 Return the standard deviation (=Sqrt(variance)) as defined from the (biased) population variance. More...
 
double stdDev () const
 Return the standard deviation (=Sqrt(variance)) as defined from the (biased) population variance. More...
 

Static Public Member Functions

static constexpr bool hasMinMax ()
 
static constexpr bool hasAverage ()
 
static constexpr bool hasStdDeviation ()
 

Protected Types

using BaseT = Extrema< ValueT, 1 >
 
using RealT = double
 

Protected Attributes

size_t mSize
 
double mAvg
 
double mAux
 

Detailed Description

template<typename ValueT>
class nanovdb::Stats< ValueT, 1 >

This class computes statistics (minimum value, maximum value, mean, variance and standard deviation) of a population of floating-point values.

variance = Mean[ (X-Mean[X])^2 ] = Mean[X^2] - Mean[X]^2, standard deviation = sqrt(variance)

Note
This class employs incremental computation and double precision.

Member Typedef Documentation

using BaseT = Extrema<ValueT, 1>
protected
using RealT = double
protected
using ValueType = ValueT

Constructor & Destructor Documentation

Stats ( )
inline

Member Function Documentation

Stats& add ( const ValueT &  val)
inline

Add a single sample.

Stats& add ( const ValueT &  val,
uint64_t  n 
)
inline

Add n samples with constant value val.

Stats& add ( const Stats< ValueT, 1 > &  other)
inline

Add the samples from the other Stats instance.

double avg ( ) const
inline

Return the arithmetic mean, i.e. average, value.

static constexpr bool hasAverage ( )
inlinestatic
static constexpr bool hasMinMax ( )
inlinestatic
static constexpr bool hasStdDeviation ( )
inlinestatic
double mean ( ) const
inline

Return the arithmetic mean, i.e. average, value.

size_t size ( ) const
inline
double std ( ) const
inline

Return the standard deviation (=Sqrt(variance)) as defined from the (biased) population variance.

double stdDev ( ) const
inline

Return the standard deviation (=Sqrt(variance)) as defined from the (biased) population variance.

double var ( ) const
inline

Return the population variance.

Note
The unbiased sample variance = population variance * num/(num-1)
double variance ( ) const
inline

Return the population variance.

Note
The unbiased sample variance = population variance * num/(num-1)

Member Data Documentation

double mAux
protected
double mAvg
protected
size_t mSize
protected