OpenVDB 10.0.1
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Attributes | List of all members
Stats< ValueT, 0 > 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>

Inheritance diagram for Stats< ValueT, 0 >:
Extrema< ValueT, 0 >

Public Types

using ValueType = ValueT
 

Public Member Functions

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

Static Public Member Functions

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

Protected Types

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

Protected Attributes

size_t mSize
 
double mAvg
 
double mAux
 
ValueT mMin
 
ValueT mMax
 

Detailed Description

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

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

◆ BaseT

template<typename ValueT >
using BaseT = Extrema<ValueT, 0>
protected

◆ RealT

template<typename ValueT >
using RealT = double
protected

◆ ValueType

template<typename ValueT >
using ValueType = ValueT

Constructor & Destructor Documentation

◆ Stats() [1/2]

template<typename ValueT >
Stats ( )
inline

◆ Stats() [2/2]

template<typename ValueT >
Stats ( const ValueT &  val)
inline

Member Function Documentation

◆ add() [1/4]

template<typename ValueT >
Extrema & add ( const Extrema< ValueT, 0 > &  other)
inlineinherited

◆ add() [2/4]

template<typename ValueT >
Stats & add ( const Stats< ValueT, 0 > &  other)
inline

Add the samples from the other Stats instance.

◆ add() [3/4]

template<typename ValueT >
Stats & add ( const ValueT &  val)
inline

Add a single sample.

◆ add() [4/4]

template<typename ValueT >
Stats & add ( const ValueT &  val,
uint64_t  n 
)
inline

Add n samples with constant value val.

◆ avg()

template<typename ValueT >
double avg ( ) const
inline

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

◆ hasAverage()

template<typename ValueT >
static constexpr bool hasAverage ( )
inlinestaticconstexpr

◆ hasMinMax()

template<typename ValueT >
static constexpr bool hasMinMax ( )
inlinestaticconstexpr

◆ hasStdDeviation()

template<typename ValueT >
static constexpr bool hasStdDeviation ( )
inlinestaticconstexpr

◆ max() [1/2]

template<typename ValueT >
const ValueT & max ( ) const
inlineinherited

◆ max() [2/2]

template<typename ValueT >
Extrema & max ( const ValueT &  v)
inlineinherited

◆ mean()

template<typename ValueT >
double mean ( ) const
inline

◆ min() [1/2]

template<typename ValueT >
const ValueT & min ( ) const
inlineinherited

◆ min() [2/2]

template<typename ValueT >
Extrema & min ( const ValueT &  v)
inlineinherited

◆ operator bool()

template<typename ValueT >
operator bool ( ) const
inlineinherited

◆ size() [1/2]

template<typename ValueT >
static constexpr size_t size ( )
inlinestaticconstexprinherited

◆ size() [2/2]

template<typename ValueT >
size_t size ( ) const
inline

◆ std()

template<typename ValueT >
double std ( ) const
inline

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

◆ stdDev()

template<typename ValueT >
double stdDev ( ) const
inline

◆ var()

template<typename ValueT >
double var ( ) const
inline

Return the population variance.

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

◆ variance()

template<typename ValueT >
double variance ( ) const
inline

Member Data Documentation

◆ mAux

template<typename ValueT >
double mAux
protected

◆ mAvg

template<typename ValueT >
double mAvg
protected

◆ mMax

template<typename ValueT >
ValueT mMax
protectedinherited

◆ mMin

template<typename ValueT >
ValueT mMin
protectedinherited

◆ mSize

template<typename ValueT >
size_t mSize
protected