Changeset 218 for trunk/src/Averager.h


Ignore:
Timestamp:
Dec 30, 2004, 11:29:15 PM (18 years ago)
Author:
Peter
Message:

sum_xsqr_centered(void) added

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/Averager.h

    r197 r218  
    9393
    9494    ///
     95    /// @return \f$ \sum_i (x_i-m)^2\f$
     96    ///
     97    inline double sum_xsqr_centered(void) const { return xx_-x_*x_/n_; }
     98
     99    ///
    95100    /// The variance is calculated using the \f$ (n-1) \f$ correction,
    96101    /// which means it is the best unbiased estimator of the variance
     
    101106    ///
    102107    inline double variance(void) const
    103     { return (n_>1) ? (xx_-x_*x_/n_)/(n_-1) : 0; }
     108    { return (n_>1) ? sum_xsqr_centered()/(n_-1) : 0; }
    104109
    105110    ///
Note: See TracChangeset for help on using the changeset viewer.