OpenVDB 11.0.0
Loading...
Searching...
No Matches
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>

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

Public Types

using ValueType = ValueT
 

Public Member Functions

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

Static Public Member Functions

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

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

◆ BaseT

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

◆ RealT

template<typename ValueT >
using RealT = double
protected

◆ ValueType

template<typename ValueT >
using ValueType = ValueT

Constructor & Destructor Documentation

◆ Stats()

template<typename ValueT >
__hostdev__ Stats ( )
inline

Member Function Documentation

◆ add() [1/3]

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

Add the samples from the other Stats instance.

◆ add() [2/3]

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

Add a single sample.

◆ add() [3/3]

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

Add n samples with constant value val.

◆ avg()

template<typename ValueT >
__hostdev__ double avg ( ) const
inline

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

◆ hasAverage()

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

◆ hasMinMax()

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

◆ hasStats()

template<typename ValueT >
static __hostdev__ constexpr bool hasStats ( )
inlinestaticconstexpr

◆ hasStdDeviation()

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

◆ mean()

template<typename ValueT >
__hostdev__ double mean ( ) const
inline

◆ setStats()

template<typename ValueT >
template<typename NodeT >
__hostdev__ void setStats ( NodeT & node) const
inline

◆ size()

template<typename ValueT >
__hostdev__ size_t size ( ) const
inline

◆ std()

template<typename ValueT >
__hostdev__ double std ( ) const
inline

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

◆ stdDev()

template<typename ValueT >
__hostdev__ double stdDev ( ) const
inline

◆ var()

template<typename ValueT >
__hostdev__ double var ( ) const
inline

Return the population variance.

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

◆ variance()

template<typename ValueT >
__hostdev__ double variance ( ) const
inline

Member Data Documentation

◆ mAux

template<typename ValueT >
double mAux
protected

◆ mAvg

template<typename ValueT >
double mAvg
protected

◆ mSize

template<typename ValueT >
size_t mSize
protected