Changeset 1600 for trunk/yat


Ignore:
Timestamp:
Oct 27, 2008, 8:10:49 PM (12 years ago)
Author:
Peter
Message:
  • Fixed bug that data disappeared because data internally was stored in a set (is now a multiset).
  • Changed ordering of data, which implies that sign of signed_score is flipped.
  • Added some tests for KolmogorovSmirnov?
Location:
trunk/yat/statistics
Files:
2 edited

Legend:

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

    r1595 r1600  
    6161    double res=0;
    6262    double res2=0;
    63     double s2 = score() * sqrt(sum_w1_*sum_w2_/(sum_w1_+sum_w2_));
    64     s2 *= s2;
     63    double s2 = score() * score() * sum_w1_*sum_w2_/(sum_w1_+sum_w2_);
    6564    int sign = 1;
    6665    for (size_t k = 1; k<100; ++k) {
    67       res += sign * exp(-2.0 * k * k * s2);
     66      res += sign * 2 * exp(-2.0 * k * k * s2);
    6867      sign *= -1;
     68      // ignore remaining terms as they are small
    6969      if (res==res2)
    7070        return res;
  • trunk/yat/statistics/KolmogorovSmirnov.h

    r1595 r1600  
    9999    mutable double score_;
    100100    typedef std::pair<std::pair<double,double>, bool> trip;
    101     typedef std::set<trip, std::greater<trip> > data_w;
     101    typedef std::multiset<trip> data_w;
    102102    data_w data_;
    103103    double sum_w1_;
Note: See TracChangeset for help on using the changeset viewer.