Changeset 2563


Ignore:
Timestamp:
Sep 25, 2011, 9:38:22 PM (10 years ago)
Author:
Peter
Message:

refs #471. handle some n=0 cases

Location:
trunk/yat/statistics
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/statistics/Averager.cc

    r2561 r2563  
    151151  const Averager& Averager::operator+=(const Averager& a)
    152152  {
     153    if (!a.n())
     154      return *this;
    153155    mean_ += (sum_x() + a.sum_x()) / (n() + a.n());
    154156    double delta = mean_ - a.mean();
  • trunk/yat/statistics/AveragerWeighted.cc

    r2562 r2563  
    160160  AveragerWeighted::operator+=(const AveragerWeighted& a)
    161161  {
     162    if (!a.w_)
     163      return *this;
    162164    mean_ += (sum_wx() + a.sum_wx()) / (sum_w() + a.sum_w());
    163165    double delta = mean() - a.mean();
Note: See TracChangeset for help on using the changeset viewer.