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 38 of file subtotal.hxx.

Constructor & Destructor Documentation

◆ WelfordRunner()

WelfordRunner::WelfordRunner ( )
inline

Definition at line 41 of file subtotal.hxx.

Member Function Documentation

◆ getCount()

sal_uInt64 WelfordRunner::getCount ( ) const
inline

Definition at line 43 of file subtotal.hxx.

References mnCount.

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

◆ getVariancePopulation()

double WelfordRunner::getVariancePopulation ( ) const
inline

Definition at line 45 of file subtotal.hxx.

References mfM2, and mnCount.

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

◆ getVarianceSample()

double WelfordRunner::getVarianceSample ( ) const
inline

Definition at line 44 of file subtotal.hxx.

References mfM2, and mnCount.

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

◆ update()

void WelfordRunner::update ( double  fVal)

Definition at line 196 of file subtotal.cxx.

References mfM2, mfMean, and mnCount.

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

Friends And Related Function Documentation

◆ ScFunctionData

friend class ScFunctionData
friend

Definition at line 52 of file subtotal.hxx.

Member Data Documentation

◆ mfM2

double WelfordRunner::mfM2
private

Definition at line 55 of file subtotal.hxx.

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

◆ mfMean

double WelfordRunner::mfMean
private

Definition at line 54 of file subtotal.hxx.

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

◆ mnCount

sal_uInt64 WelfordRunner::mnCount
private

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