# Changeset 97

Ignore:
Timestamp:
Jun 9, 2004, 6:30:41 PM (18 years ago)
Message:

removed the weights

Location:
trunk/src
Files:
2 edited

### Legend:

Unmodified
 r95 /// /// Constructor taking the first value. /// Constructor taking the value of first data point. /// Averager(double); /// /// adding a data point d, with weight w (default is 1) /// adding n(default=1) number of data point(s) with value d. /// inline void add(const double d,const double w=1) {n_+=w; x_+=d*w; xx_+=d*d*w;} inline void add(const double d,const long n=1) {n_+=n; x_+=n*d; xx_+=n*d*d;} /// /// /// @return second moment (mean of squares) /// @return sum of squared values \f$\sum x_i^2 \f$ /// inline double average_sqr(void) const {return mean_sqr();} /// /// @return average /// @return average \f$\frac{\sum x_i}{n} \f$ /// inline double mean(void) const { return n_ ? x_/n_ : 0; } /// /// @return second moment (mean of squares) /// @return @return sum of squared values \f$\sum x_i^2 \f$. /// inline double mean_sqr(void) const { return n_ ? xx_/n_ : 0; } /// resets everything to zero /// inline void reset(void) { n_=x_=xx_=0;} inline void reset(void) { n_=0; x_=xx_=0.0;} /// /// ///The variance is calculated using the (n-1) correction so the ///expectation value is unbiased @return variance of mean ///The variance is calculated using the (n-1) correction, so the ///expectation value is unbiased @return variance /// inline double variance(void) const private: double  n_; long  n_; double  x_, xx_; };