OpenVDB  11.0.0
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>

Inherits Extrema< ValueT, 0 >.

Public Types

using ValueType = ValueT
 

Public Member Functions

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

Static Public Member Functions

static constexpr __hostdev__ bool hasMinMax ()
 
static constexpr __hostdev__ bool hasAverage ()
 
static constexpr __hostdev__ bool hasStdDeviation ()
 
static constexpr __hostdev__ bool hasStats ()
 
static constexpr __hostdev__ 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

using BaseT = Extrema<ValueT, 0>
protected

◆ RealT

using RealT = double
protected

◆ ValueType

using ValueType = ValueT

Constructor & Destructor Documentation

◆ Stats() [1/2]

__hostdev__ Stats ( )
inline

◆ Stats() [2/2]

__hostdev__ Stats ( const ValueT &  val)
inline

Member Function Documentation

◆ add() [1/4]

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

◆ add() [2/4]

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

Add the samples from the other Stats instance.

◆ add() [3/4]

__hostdev__ Stats& add ( const ValueT &  val)
inline

Add a single sample.

◆ add() [4/4]

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

Add n samples with constant value val.

◆ avg()

__hostdev__ double avg ( ) const
inline

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

◆ hasAverage()

static constexpr __hostdev__ bool hasAverage ( )
inlinestaticconstexpr

◆ hasMinMax()

static constexpr __hostdev__ bool hasMinMax ( )
inlinestaticconstexpr

◆ hasStats()

static constexpr __hostdev__ bool hasStats ( )
inlinestaticconstexpr

◆ hasStdDeviation()

static constexpr __hostdev__ bool hasStdDeviation ( )
inlinestaticconstexpr

◆ max() [1/2]

__hostdev__ const ValueT& max ( ) const
inlineinherited

◆ max() [2/2]

__hostdev__ Extrema& max ( const ValueT &  v)
inlineinherited

◆ mean()

__hostdev__ double mean ( ) const
inline

◆ min() [1/2]

__hostdev__ const ValueT& min ( ) const
inlineinherited

◆ min() [2/2]

__hostdev__ Extrema& min ( const ValueT &  v)
inlineinherited

◆ operator bool()

__hostdev__ operator bool ( ) const
inlineinherited

◆ setStats()

__hostdev__ void setStats ( NodeT &  node) const
inline

◆ size() [1/2]

static constexpr __hostdev__ size_t size ( )
inlinestaticconstexprinherited

◆ size() [2/2]

__hostdev__ size_t size ( ) const
inline

◆ std()

__hostdev__ double std ( ) const
inline

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

◆ stdDev()

__hostdev__ double stdDev ( ) const
inline

◆ var()

__hostdev__ double var ( ) const
inline

Return the population variance.

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

◆ variance()

__hostdev__ double variance ( ) const
inline

Member Data Documentation

◆ mAux

double mAux
protected

◆ mAvg

double mAvg
protected

◆ mMax

ValueT mMax
protectedinherited

◆ mMin

ValueT mMin
protectedinherited

◆ mSize

size_t mSize
protected