Changeset 1735
- Timestamp:
- Jan 16, 2009, 10:33:53 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/normalization_test.cc
r1728 r1735 150 150 // Enough iteration will make all columns to have the same values as 151 151 // the target. 152 suite.err() << "Testing that iterative normalization works\n";152 suite.err() << "Testing that q=matrix rows gives QuantileNormaliztion\n"; 153 153 utility::Matrix m2(4,2); 154 154 m2(0,0) = 0; m2(0,1) = 10; … … 159 159 utility::Matrix result2(m2.rows(),m2.columns()); 160 160 qqn2(m2,result2); 161 for (int d=0; d<50; ++d)162 qqn2(result2,result2);163 161 suite.add( suite.equal_fix(m2(0,0),result2(2,1),1.0e-12) && 164 162 suite.equal_fix(m2(1,0),result2(3,1),1.0e-12) && -
trunk/yat/normalizer/qQuantileNormalizer.cc
r1731 r1735 53 53 for (unsigned int r=start; r<end; ++r) 54 54 av.add(sortedvec(r)); 55 average_(i) =av.mean();56 index_(i) = static_cast<double>(end+start)/2;55 average_(i) = av.mean(); 56 index_(i) = 0.5*(end+start-1); 57 57 start=end; 58 58 } … … 109 109 size_t start=0; 110 110 size_t end=static_cast<unsigned int>(idx(0)); 111 if (end<idx(0)) 111 // The first condition below takes care of limiting case number 112 // of parts approximately equal to the number of matrix rows and 113 // the second condition makes sure that index is larege enough 114 // when using cspline below ... the static cast above takes the 115 // floor whereas we want to take the "roof" forcing next index 116 // range to be within interpolation range for the cspline. 117 if ((end==0) || (end<idx(0))) 112 118 ++end; 113 119 for (size_t row=start; row<end; ++row) { … … 116 122 } 117 123 118 // cspline interpolation for all data between the first and last119 // parts124 // cspline interpolation for all data between the mid points of 125 // the first and last part 120 126 start=end; 121 127 end=static_cast<unsigned int>(idx(target_.size()-1)); 128 // take care of limiting case number of parts approximately 129 // equal to the number of matrix rows 130 if (end==(matrix.rows()-1)) 131 --end; 122 132 for (size_t row=start; row<=end; ++row) { 123 133 size_t srow=sorted_index[column][row];
Note: See TracChangeset
for help on using the changeset viewer.