numerics 0.1.0
Loading...
Searching...
No Matches
num::RunningStats Struct Reference

Welford updates for mean and variance. More...

#include <stats.hpp>

Public Member Functions

void update (real x)
 
real variance () const
 
real std_dev () const
 
real stderr_mean () const
 
void reset ()
 

Public Attributes

real mean = 0.0
 
real M2 = 0.0
 
idx count = 0
 

Detailed Description

Welford updates for mean and variance.

Definition at line 12 of file stats.hpp.

Member Function Documentation

◆ reset()

void num::RunningStats::reset ( )
inline

Definition at line 35 of file stats.hpp.

References count, M2, and mean.

◆ std_dev()

real num::RunningStats::std_dev ( ) const
inline

Definition at line 29 of file stats.hpp.

References variance().

Referenced by stderr_mean().

◆ stderr_mean()

real num::RunningStats::stderr_mean ( ) const
inline

Definition at line 31 of file stats.hpp.

References count, and std_dev().

◆ update()

void num::RunningStats::update ( real  x)
inline

Definition at line 17 of file stats.hpp.

References count, M2, and mean.

◆ variance()

real num::RunningStats::variance ( ) const
inline

Definition at line 25 of file stats.hpp.

References count, and M2.

Referenced by std_dev().

Member Data Documentation

◆ count

idx num::RunningStats::count = 0

Definition at line 15 of file stats.hpp.

Referenced by reset(), stderr_mean(), update(), and variance().

◆ M2

real num::RunningStats::M2 = 0.0

Definition at line 14 of file stats.hpp.

Referenced by reset(), update(), and variance().

◆ mean

real num::RunningStats::mean = 0.0

Definition at line 13 of file stats.hpp.

Referenced by reset(), and update().


The documentation for this struct was generated from the following file: