LibreOffice Module sc (master)  1
Public Member Functions | Private Attributes | Friends | List of all members
WelfordRunner Class Reference

Implements the Welford Online one-pass algorithm. More...

#include <subtotal.hxx>

Public Member Functions

 WelfordRunner ()
 
void update (double fVal)
 
sal_uInt64 getCount () const
 
double getVarianceSample () const
 
double getVariancePopulation () const
 

Private Attributes

double mfMean
 
double mfM2
 
sal_uInt64 mnCount
 

Friends

class ScFunctionData
 

Detailed Description

Implements the Welford Online one-pass algorithm.

See https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Welford's_Online_algorithm and Donald E. Knuth, TAoCP vol.2, 3rd edn., p. 232

Definition at line 39 of file subtotal.hxx.

Constructor & Destructor Documentation

WelfordRunner::WelfordRunner ( )
inline

Definition at line 42 of file subtotal.hxx.

Member Function Documentation

sal_uInt64 WelfordRunner::getCount ( ) const
inline

Definition at line 44 of file subtotal.hxx.

References mnCount.

Referenced by ScDPAggData::Calculate(), and ScFunctionData::getResult().

double WelfordRunner::getVariancePopulation ( ) const
inline

Definition at line 46 of file subtotal.hxx.

References mfM2, and mnCount.

Referenced by ScDPAggData::Calculate(), and ScFunctionData::getResult().

double WelfordRunner::getVarianceSample ( ) const
inline

Definition at line 45 of file subtotal.hxx.

References mfM2, and mnCount.

Referenced by ScDPAggData::Calculate(), and ScFunctionData::getResult().

void WelfordRunner::update ( double  fVal)

Definition at line 196 of file subtotal.cxx.

References mfM2, mfMean, and mnCount.

Referenced by ScFunctionData::update(), and ScDPAggData::Update().

Friends And Related Function Documentation

friend class ScFunctionData
friend

Definition at line 53 of file subtotal.hxx.

Member Data Documentation

double WelfordRunner::mfM2
private

Definition at line 56 of file subtotal.hxx.

Referenced by getVariancePopulation(), getVarianceSample(), and update().

double WelfordRunner::mfMean
private

Definition at line 55 of file subtotal.hxx.

Referenced by ScFunctionData::getValueRef(), and update().

sal_uInt64 WelfordRunner::mnCount
private

The documentation for this class was generated from the following files: