X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2Ffpa%2FCommon%2FIncrementalMeanAndVariance.cxx;fp=lib%2Ffpa%2FCommon%2FIncrementalMeanAndVariance.cxx;h=0000000000000000000000000000000000000000;hb=a8ac405fe1422bc0792a810f7f0693096a22c20e;hp=ea88f0324c06827d3240f53a8385ddb13640506d;hpb=8abe87eaa0d29ba667d5cbf35f4ca1ca2e38c6c4;p=FrontAlgorithms.git diff --git a/lib/fpa/Common/IncrementalMeanAndVariance.cxx b/lib/fpa/Common/IncrementalMeanAndVariance.cxx deleted file mode 100644 index ea88f03..0000000 --- a/lib/fpa/Common/IncrementalMeanAndVariance.cxx +++ /dev/null @@ -1,74 +0,0 @@ -// ========================================================================= -// @author Leonardo Florez Valencia -// @email florez-l@javeriana.edu.co -// ========================================================================= -#include -#include - -// ------------------------------------------------------------------------- -fpa::Common::IncrementalMeanAndVariance:: -IncrementalMeanAndVariance( ) -{ - this->Clear( ); -} - -// ------------------------------------------------------------------------- -fpa::Common::IncrementalMeanAndVariance:: -~IncrementalMeanAndVariance( ) -{ -} - -// ------------------------------------------------------------------------- -double fpa::Common::IncrementalMeanAndVariance:: -GetMean( ) const -{ - return( this->m_M ); -} - -// ------------------------------------------------------------------------- -double fpa::Common::IncrementalMeanAndVariance:: -GetVariance( ) const -{ - return( this->m_V ); -} - -// ------------------------------------------------------------------------- -double fpa::Common::IncrementalMeanAndVariance:: -GetDeviation( ) const -{ - return( std::sqrt( this->m_V ) ); -} - -// ------------------------------------------------------------------------- -unsigned long fpa::Common::IncrementalMeanAndVariance:: -GetNumberOfSamples( ) const -{ - return( ( unsigned long )( this->m_N ) ); -} - -// ------------------------------------------------------------------------- -void fpa::Common::IncrementalMeanAndVariance:: -Clear( ) -{ - this->m_M = double( 0 ); - this->m_V = double( 0 ); - this->m_N = double( 0 ); -} - -// ------------------------------------------------------------------------- -void fpa::Common::IncrementalMeanAndVariance:: -AddValue( double v ) -{ - this->m_N += double( 1 ); - double d = v - this->m_M; - if( this->m_N > double( 1 ) ) - { - double o = ( this->m_N - double( 2 ) ) / ( this->m_N - double( 1 ) ); - this->m_V = ( o * this->m_V ) + ( ( d * d ) / this->m_N ); - } - else - this->m_V = double( 0 ); - this->m_M += d / this->m_N; -} - -// eof - $RCSfile$