Changeset 1773


Ignore:
Timestamp:
Feb 5, 2009, 1:56:03 PM (12 years ago)
Author:
Peter
Message:

adding a test to check that qQN give same result with weighted source as with unweighted source. The test failed, which implies weighted and unweighted method are not in synch. refs #478

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/normalization_test.cc

    r1750 r1773  
    176176  suite.err() << "Testing qQuantileNormalizer weighted\n";
    177177
    178   std::vector<utility::DataWeight> vec;
    179   vec.reserve(100);
    180   for (size_t i=0; i<100; ++i)
    181     vec.push_back(utility::DataWeight(i, 1.0));
    182   qQuantileNormalizer qQN(vec.begin(), vec.end(), 5);
    183   qQN(vec.begin(), vec.end(), vec.begin());
     178  // test with unweighted target and source
     179  std::vector<double> target;
     180  while (target.size()<1000)
     181    target.push_back(target.size());
     182  qQuantileNormalizer qQN(target.begin(), target.end(), 4);
     183  std::vector<double> source;
     184  while (source.size()<10)
     185    source.push_back(source.size()*10);
     186  qQN(source.begin(), source.end(), source.begin());
     187 
     188  // test with unweighted target and weighted source
     189  std::vector<utility::DataWeight> src_w(source.size());
     190  std::copy(source.begin(), source.end(),
     191            utility::data_iterator(src_w.begin()));
     192  std::fill(utility::weight_iterator(src_w.begin()),
     193            utility::weight_iterator(src_w.end()), 1.0);
     194
     195  qQN(src_w.begin(), src_w.end(), src_w.begin());
     196  // FIXME: this test fails
     197  suite.xadd(suite.equal_range(source.begin(), source.end(),
     198                              utility::data_iterator(src_w.begin())));
    184199}
    185200
Note: See TracChangeset for help on using the changeset viewer.