Changeset 1297


Ignore:
Timestamp:
May 13, 2008, 4:20:23 PM (13 years ago)
Author:
Jari Häkkinen
Message:

Fixes #361. Removed tests negative count n in averager.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/averager_test.cc

    r1296 r1297  
    7676    suite.err() << "error: add with negative n\n";
    7777  }
    78   b.add(5,-4);
    79   if (b.n()!=-2 || b.mean()!=8 || b.sum_xx()!=-90){
    80     suite.add(false);
    81     suite.err() << "error: add with negatibe n\n";
    82   }
    83 
    8478
    8579  Averager* a1 = new Averager(1.0+3+5,1.0+9+25,3);
     
    113107  }
    114108     
    115 
    116109  if ( std::abs(a.variance() - a.std()*a.std())>
    117110       std::numeric_limits<double>().round_error() ){
     
    218211                << std::endl;
    219212  }
    220   ap.add(static_cast<double>(1),1,-4);
    221   if (std::abs(ap.correlation()+1)>tol || ap.n()!=-2) {
    222     suite.add(false);
    223     suite.err() << "AveragerPair error: add with negatibe n\n";
    224   }
    225213
    226214
  • trunk/yat/statistics/Averager.cc

    r1295 r1297  
    5252    assert(!std::isnan(d));
    5353    n_  += n;
    54     assert(n>-1);
     54    assert(n_>-1);
    5555    x_  += n*d;
    5656    xx_ += n*d*d;
Note: See TracChangeset for help on using the changeset viewer.