Changeset 1739
- Timestamp:
- Jan 21, 2009, 2:34:18 AM (12 years ago)
- Location:
- trunk/yat/normalizer
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/yat/normalizer/Centralizer.h
r1717 r1739 74 74 75 75 \see std::transform 76 77 \return result + (last-first)78 76 */ 79 77 template<class InputIterator, class OutputIterator> 80 OutputIteratoroperator()(InputIterator first, InputIterator last,81 78 void operator()(InputIterator first, InputIterator last, 79 OutputIterator result) const 82 80 { 83 81 typename utility::weighted_iterator_traits<InputIterator>::type tag; 84 return normalize(first, last, result, tag); 85 82 normalize(first, last, result, tag); 86 83 } 87 84 … … 91 88 // unweighted version 92 89 template<class InputIterator, class OutputIterator> 93 OutputIterator normalize(InputIterator first, InputIterator last, 94 OutputIterator result, 95 utility::unweighted_iterator_tag tag) const 90 void normalize(InputIterator first,InputIterator last,OutputIterator result, 91 utility::unweighted_iterator_tag tag) const 96 92 { 97 return std::transform(first, last, 98 result, std::bind2nd(std::minus<double>(), 99 func_(first, last))); 93 std::transform(first, last, result, 94 std::bind2nd(std::minus<double>(), func_(first, last))); 100 95 } 101 96 … … 103 98 // weighted version 104 99 template<class InputIterator, class OutputIterator> 105 OutputIterator normalize(InputIterator first, InputIterator last, 106 OutputIterator result, 107 utility::weighted_iterator_tag tag) const 100 void normalize(InputIterator first,InputIterator last,OutputIterator result, 101 utility::weighted_iterator_tag tag) const 108 102 { 109 103 std::copy(utility::weight_iterator(first), … … 113 107 utility::data_iterator(last), 114 108 utility::data_iterator(result), 115 std::bind2nd(std::minus<double>(), 116 func_(first, last))); 117 return result + std::distance(first, last); 109 std::bind2nd(std::minus<double>(),func_(first, last))); 118 110 } 119 111 -
trunk/yat/normalizer/Gauss.h
r1717 r1739 53 53 54 54 \see gsl_cdf_ugaussian_Pinv 55 56 \return result + (last-first)57 55 */ 58 56 template<typename ForwardIterator, typename RandomAccessIterator> 59 RandomAccessIteratoroperator()(ForwardIterator first, ForwardIterator last,60 57 void operator()(ForwardIterator first, ForwardIterator last, 58 RandomAccessIterator result) const 61 59 { 62 60 Spearman spearman; … … 68 66 ++result; 69 67 } 70 71 return result;72 68 } 73 69 -
trunk/yat/normalizer/Spearman.h
r1717 r1739 57 57 permissible for the iterators \a first and \a result to be the 58 58 same. 59 60 \return result + (last-first)61 59 */ 62 60 template<typename ForwardIterator, typename RandomAccessIterator> 63 RandomAccessIteratoroperator()(ForwardIterator first, ForwardIterator last,64 61 void operator()(ForwardIterator first, ForwardIterator last, 62 RandomAccessIterator result) const 65 63 { 66 64 typename utility::weighted_iterator_traits<ForwardIterator>::type tag; 67 returnnormalize(first, last, result, tag);65 normalize(first, last, result, tag); 68 66 } 69 67 … … 72 70 // unweighted version 73 71 template<typename ForwardIterator, typename RandomAccessIterator> 74 RandomAccessIteratornormalize(ForwardIterator first, ForwardIterator last,75 76 72 void normalize(ForwardIterator first, ForwardIterator last, 73 RandomAccessIterator result, 74 utility::unweighted_iterator_tag) const 77 75 { 78 76 std::vector<size_t> perm; … … 88 86 result[perm[min_i]] = res; 89 87 } 90 return result + std::distance(first, last);91 88 } 92 89 … … 94 91 // weighted version 95 92 template<typename ForwardIterator, typename RandomAccessIterator> 96 RandomAccessIteratornormalize(ForwardIterator first, ForwardIterator last,97 98 93 void normalize(ForwardIterator first, ForwardIterator last, 94 RandomAccessIterator result, 95 utility::weighted_iterator_tag) const 99 96 { 100 97 std::copy(utility::weight_iterator(first), … … 134 131 utility::data_iterator(result), 135 132 std::bind2nd(std::divides<double>(), sum_w)); 136 return result + n;137 133 } 138 134 -
trunk/yat/normalizer/Zscore.h
r1717 r1739 54 54 permissible for the iterators \a first and \a result to be the 55 55 same. \see std::transform 56 57 \return result + (last-first)58 56 */ 59 57 template<class InputIterator, class OutputIterator> 60 OutputIteratoroperator()(InputIterator first, InputIterator last,61 58 void operator()(InputIterator first, InputIterator last, 59 OutputIterator result) const 62 60 { 63 61 typename utility::weighted_iterator_traits<InputIterator>::type tag; 64 returnnormalize(first, last, result, tag);62 normalize(first, last, result, tag); 65 63 } 66 64 67 65 private: 68 66 template<class InputIterator, class OutputIterator> 69 OutputIterator normalize(InputIterator first, InputIterator last, 70 OutputIterator result, 71 utility::unweighted_iterator_tag tag) const 67 void normalize(InputIterator first,InputIterator last,OutputIterator result, 68 utility::unweighted_iterator_tag tag) const 72 69 { 73 70 statistics::Averager a; … … 80 77 ++result; 81 78 } 82 return result;83 79 } 84 80 85 81 template<class InputIterator, class OutputIterator> 86 OutputIterator normalize(InputIterator first, InputIterator last, 87 OutputIterator result, 88 utility::weighted_iterator_tag tag) const 82 void normalize(InputIterator first,InputIterator last,OutputIterator result, 83 utility::weighted_iterator_tag tag) const 89 84 { 90 85 std::copy(utility::weight_iterator(first), … … 101 96 ++result; 102 97 } 103 return result;104 98 } 105 106 99 }; 107 100 -
trunk/yat/normalizer/qQuantileNormalizer.cc
r1738 r1739 80 80 statistics::AveragerWeighted av; 81 81 double end_sum_w = (i+1) * total_w / N - sum_w; 82 std::cout << "end_sum_w: " << end_sum_w << std::endl;83 82 if (i!=N-1) { 84 83 while(av.sum_w() < end_sum_w) { -
trunk/yat/normalizer/qQuantileNormalizer.h
r1738 r1739 99 99 */ 100 100 template<typename RandomAccessIterator1, typename RandomAccessIterator2> 101 RandomAccessIterator2 operator()(RandomAccessIterator1 first, 102 RandomAccessIterator1 last, 103 RandomAccessIterator2 result) const; 101 void operator()(RandomAccessIterator1 first, RandomAccessIterator1 last, 102 RandomAccessIterator2 result) const; 104 103 105 104 private: … … 176 175 177 176 template<typename RandomAccessIterator1, typename RandomAccessIterator2> 178 RandomAccessIterator2 179 qQuantileNormalizer::operator()(RandomAccessIterator1 first, 180 RandomAccessIterator1 last, 181 RandomAccessIterator2 result) const 177 void qQuantileNormalizer::operator()(RandomAccessIterator1 first, 178 RandomAccessIterator1 last, 179 RandomAccessIterator2 result) const 182 180 { 183 181 size_t N = last-first; … … 232 230 result[srow] = first[srow] - diff(diff.size()-1); 233 231 } 234 return result + N;235 232 } 236 233
Note: See TracChangeset
for help on using the changeset viewer.