Changeset 2466 for branches/0.7-stable


Ignore:
Timestamp:
Apr 12, 2011, 2:10:59 AM (11 years ago)
Author:
Peter
Message:

Fixed so percentiler ignores element with zero weight

Location:
branches/0.7-stable
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/0.7-stable/test/statistics.cc

    r2444 r2466  
    271271                     RandomAccessIterator2 last2)
    272272{
    273   for (double p=0; p<100; p+=10) {
     273  for (double p=0; p<=100; p+=10) {
    274274    double correct=statistics::percentile2(first1, last1, p);
    275275    test_percentiler(suite, first2, last2, p, correct);
  • branches/0.7-stable/yat/statistics/Percentiler.h

    r2465 r2466  
    181181      while (upper!=accum_w.end() && *upper <= w_bound+margin)
    182182        ++upper;
    183       if (upper==accum_w.end())
     183      while (upper!=accum_w.begin() &&
     184             (upper==accum_w.end() ||
     185              trait.weight(first+(upper-accum_w.begin()))==0.0))
    184186        --upper;
    185187      std::vector<double>::const_iterator lower(upper);
Note: See TracChangeset for help on using the changeset viewer.