Changeset 1713


Ignore:
Timestamp:
Jan 13, 2009, 8:07:56 PM (12 years ago)
Author:
Jari Häkkinen
Message:

Addresses #425. Added static_cast to get rid of compiler warnings. Fixed index problems in Partitioner.

File:
1 edited

Legend:

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

    r1712 r1713  
    4242    assert(N>1);
    4343    assert(N<=vec.size());
    44     double range=vec.size();
    45     range/=N;
     44    double range=static_cast<double>(vec.size())/N;
    4645    assert(range);
    4746    utility::Vector sortedvec(vec);
    4847    std::sort(sortedvec.begin(),sortedvec.end());
    49     unsigned int first=0;
     48    unsigned int start=0;
    5049    for (unsigned int i=0; i<N; ++i) {
    51       unsigned int end   = ( i==(N-1) ? sortedvec.size() : first+range );
     50      unsigned int end = ( i==(N-1) ? sortedvec.size() :
     51                           static_cast<unsigned int>((i+1)*range) );
    5252      statistics::Averager av;
    53       for (unsigned int r=first; r<end; ++r)
     53      for (unsigned int r=start; r<end; ++r)
    5454        av.add(sortedvec(r));
    5555      average_(i)=av.mean();
    56       index_(i)= (i+0.5)*range;
    57       first=end;
     56      index_(i)= static_cast<double>(end-start)/2 + start;
     57      start=end;
    5858    }
    5959  }
     
    107107      // all points in the first part.
    108108      size_t start=0;
    109       size_t end=idx(0);
     109      size_t end=static_cast<unsigned int>(idx(0));
    110110      for (size_t row=start; row<end; ++row) {
    111111        size_t srow=sorted_index[column][row];
     
    115115      // cspline interpolation for all data between the first and last
    116116      // parts
    117       start=idx(0);
    118       end=idx(target_.size()-1);
     117      start=static_cast<unsigned int>(idx(0));
     118      end=static_cast<unsigned int>(idx(target_.size()-1));
    119119      for (size_t row=start; row<=end; ++row) {
    120120        size_t srow=sorted_index[column][row];
     
    124124      // linear interpolation for last part, i.e., use last diff for
    125125      // all points in the last part.
    126       start=idx(target_.size()-1)+1;
     126      start=static_cast<unsigned int>(idx(target_.size()-1)+1);
    127127      end=result.rows();
    128128      for (size_t row=start; row<end; ++row) {
Note: See TracChangeset for help on using the changeset viewer.