- Timestamp:
- Jan 13, 2009, 8:07:56 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/yat/normalizer/qQuantileNormalizer.cc
r1712 r1713 42 42 assert(N>1); 43 43 assert(N<=vec.size()); 44 double range=vec.size(); 45 range/=N; 44 double range=static_cast<double>(vec.size())/N; 46 45 assert(range); 47 46 utility::Vector sortedvec(vec); 48 47 std::sort(sortedvec.begin(),sortedvec.end()); 49 unsigned int first=0;48 unsigned int start=0; 50 49 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) ); 52 52 statistics::Averager av; 53 for (unsigned int r= first; r<end; ++r)53 for (unsigned int r=start; r<end; ++r) 54 54 av.add(sortedvec(r)); 55 55 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; 58 58 } 59 59 } … … 107 107 // all points in the first part. 108 108 size_t start=0; 109 size_t end= idx(0);109 size_t end=static_cast<unsigned int>(idx(0)); 110 110 for (size_t row=start; row<end; ++row) { 111 111 size_t srow=sorted_index[column][row]; … … 115 115 // cspline interpolation for all data between the first and last 116 116 // 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)); 119 119 for (size_t row=start; row<=end; ++row) { 120 120 size_t srow=sorted_index[column][row]; … … 124 124 // linear interpolation for last part, i.e., use last diff for 125 125 // all points in the last part. 126 start= idx(target_.size()-1)+1;126 start=static_cast<unsigned int>(idx(target_.size()-1)+1); 127 127 end=result.rows(); 128 128 for (size_t row=start; row<end; ++row) {
Note: See TracChangeset
for help on using the changeset viewer.