OpenVDB 12.1.0

Loading...
Searching...
No Matches
Stats Class Reference

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

`#include <openvdb/math/Stats.h>`

Inheritance diagram for Stats:

## Public Member Functions
| Stats ()
void | add (double val)
| Add a single sample.
void | add (double val, uint64_t n)
| Add n samples with constant value val.
void | add (const Stats &other)
| Add the samples from the other Stats instance.
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
void | print (const std::string &name="", std::ostream &strm=std::cout, int precision=3) const
| Print statistics to the specified output stream.
void | add (const Extrema &other)
| Add the samples from the other Stats instance.
uint64_t | size () const
| Return the size of the population, i.e., the total number of samples.
double | min () const
| Return the minimum value.
double | max () const
| Return the maximum value.
double | range () const
| Return the range defined as the maximum value minus the minimum value.

## Protected Member Functions
void | join (const Extrema &other)

## Protected Attributes
double | mAvg
double | mAux
uint64_t | mSize
double | mMin
double | mMax

## Detailed Description

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.

## Constructor & Destructor Documentation

## ◆ Stats()

Stats | ( |  | ) |
| inline

## Member Function Documentation

## ◆ add() [1/4]

void add | ( | const Extrema & | other | ) |
| inline inherited

Add the samples from the other Stats instance.

## ◆ add() [2/4]

void add | ( | const Stats & | other | ) |
| inline

Add the samples from the other Stats instance.

## ◆ add() [3/4]

void add | ( | double | val | ) |
| inline

Add a single sample.

## ◆ add() [4/4]

void add | ( | double | val,
|  | uint64_t | n )
| inline

Add n samples with constant value val.

## ◆ avg()

double avg | ( |  | ) | const
| inline

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

## ◆ join()

void join | ( | const Extrema & | other | ) |
| inline protected inherited

## ◆ max()

double max | ( |  | ) | const
| inline inherited

Return the maximum value.

## ◆ mean()

double mean | ( |  | ) | const
| inline

## ◆ min()

double min | ( |  | ) | const
| inline inherited

Return the minimum value.

## ◆ print()

void print | ( | const std::string & | name = "",
|  | std::ostream & | strm = std::cout,
|  | int | precision = 3 ) const
| inline

Print statistics to the specified output stream.

## ◆ range()

double range | ( |  | ) | const
| inline inherited

Return the range defined as the maximum value minus the minimum value.

## ◆ size()

uint64_t size | ( |  | ) | const
| inline inherited

Return the size of the population, i.e., the total number of samples.

## ◆ std()

double std | ( |  | ) | const
| inline

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

## ◆ stdDev()

double stdDev | ( |  | ) | const
| inline

## ◆ var()

double var | ( |  | ) | const
| inline

Return the population variance.

Note
  The unbiased sample variance = population variance *

## ◆ variance()

double variance | ( |  | ) | const
| inline

## Member Data Documentation

## ◆ mAux

double mAux
| protected

## ◆ mAvg

double mAvg
| protected

## ◆ mMax

double mMax
| protected

## ◆ mMin

double mMin
| protected

## ◆ mSize

uint64_t mSize
| protected