Changeset 165


Ignore:
Timestamp:
Sep 23, 2004, 9:32:12 AM (17 years ago)
Author:
Peter
Message:

.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/AveragerPair.h

    r138 r165  
    9090    ///
    9191    inline double correlation(void) const
    92     { return (n()>1) ? (covariance() / (x_.std()*y_.std()) ) : 0; }
     92    { return (x_.std()>0 && y_.std()>0) ?
     93        (covariance() / (x_.std()*y_.std()) ) : 0; }
    9394 
    9495    ///
    9596    /// The covariance is calculated using the (n-1) correction, which
    96     ///means it is the best unbiased estimator of the covariance \f$
    97     ///\frac{1}{N-1}\sum_i (x_i-m_x)(y_i-m_y)\f$, where \f$m\f$ is the
    98     ///mean@return covariance
     97    /// means it is the best unbiased estimator of the covariance \f$
     98    /// \frac{1}{N-1}\sum_i (x_i-m_x)(y_i-m_y)\f$, where \f$m\f$ is the
     99    /// mean. @return covariance
    99100    ///
    100101    inline double covariance(void) const
Note: See TracChangeset for help on using the changeset viewer.