Changeset 670


Ignore:
Timestamp:
Oct 7, 2006, 7:35:30 AM (15 years ago)
Author:
Peter
Message:

added cv function in Averager

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/c++_tools/statistics/Averager.h

    r620 r670  
    4545    /// Adding each value in an array \a v \a n (default=1)
    4646    /// number of times. The requirements for the type T of the
    47     /// array \a v are: operator[] returning an element and function
     47    /// array \a v are: operator[] returning an element and function
    4848    /// size() returning the number of elements.
    4949    ///   
     
    5252    void  add_values(const T& v, u_long n=1);
    5353
     54    /**
     55       @brief Coeffient of variation
     56
     57       Coeffient of variation (cv) is defined as ratio between the
     58       standard deviation and the mean: \f$ \frac{\sigma}{\mu} \f$.
     59       
     60       @return standard deviation divided by mean.
     61    */
     62    inline double cv(void) const { return x_ ? std()/mean() : 0; }
     63
    5464    ///
    5565    /// @return Mean of presented data, \f$ \frac{1}{n}\sum x_i \f$
    5666    ///
    5767    inline double mean(void) const { return n_ ? x_/n_ : 0; }
    58  
     68
    5969    ///
    6070    /// @return Number of data points
Note: See TracChangeset for help on using the changeset viewer.