Changeset 1771


Ignore:
Timestamp:
Feb 4, 2009, 6:27:27 PM (12 years ago)
Author:
Peter
Message:

rescaling index - refs #478

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/normalizer/qQuantileNormalizer.h

    r1768 r1771  
    156156
    157157
     158    size_t N_target_;
    158159    Partitioner target_;
    159160
     
    179180                                           BidirectionalIterator last,
    180181                                           unsigned int Q)
    181     : target_(Partitioner(first, last, Q))
     182    : N_target_(std::distance(first, last)),
     183      target_(Partitioner(first, last, Q))
    182184  {
    183185    utility::yat_assert<std::runtime_error>(Q>2,
     
    216218    utility::Vector diff(source.averages());
    217219    diff-=target_.averages();
    218     const utility::Vector& idx=target_.index();
     220    utility::Vector idx=target_.index();
     221    // if N_target_ is different from N_source_ we need to rescale the
     222    // idx so they stretch over same range
     223    idx *= static_cast<double>(N)/static_cast<double>(N_target_);
     224
    219225    regression::CSplineInterpolation cspline(idx,diff);
    220226
Note: See TracChangeset for help on using the changeset viewer.