 Timestamp:
 May 15, 2008, 12:44:30 AM (13 years ago)
 Location:
 trunk/yat/statistics
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

trunk/yat/statistics/PearsonDistance.h
r1275 r1306 26 26 */ 27 27 28 #include "AveragerPair.h" 29 #include "AveragerPairWeighted.h" 28 #include "averager_traits.h" 30 29 #include "yat/utility/iterator_traits.h" 31 30 … … 63 62 (Iter1 beg1,Iter1 end1, Iter2 beg2) const 64 63 { 65 return this>distance(beg1, end1, beg2, 66 typename utility::weighted_if_any2<Iter1,Iter2>::type()); 67 } 68 69 private: 70 template <typename Iter1, typename Iter2> 71 double distance (Iter1 beg1,Iter1 end1, Iter2 beg2, 72 utility::unweighted_iterator_tag) const 73 { 74 AveragerPairWeighted ap; 64 typename averager_pair<Iter1, Iter2>::type ap; 75 65 add(ap,beg1,end1,beg2); 76 66 return 1ap.correlation(); 77 67 } 78 79 template <typename Iter1, typename Iter2>80 double distance (Iter1 beg1,Iter1 end1, Iter2 beg2,81 utility::weighted_iterator_tag) const82 {83 AveragerPairWeighted ap;84 add(ap,beg1,end1,beg2);85 return 1ap.correlation();86 }87 88 68 }; 89 69 
trunk/yat/statistics/averager_traits.h
r1305 r1306 25 25 */ 26 26 27 #include "yat/utility/iterator_traits.h"28 27 #include "Averager.h" 29 28 #include "AveragerWeighted.h" 29 #include "AveragerPair.h" 30 #include "AveragerPairWeighted.h" 31 #include "yat/utility/iterator_traits.h" 30 32 31 33 namespace theplu { … … 49 51 */ 50 52 typedef Averager type; 53 typedef AveragerPair pair_type; 51 54 }; 52 55 … … 61 64 */ 62 65 typedef AveragerWeighted type; 66 typedef AveragerPairWeighted pair_type; 63 67 }; 64 68 65 69 /** 66 Convenience wrapper around averager_t 67 \see averager_t 70 Convenience wrapper around averager_traits 68 71 \see weighted_iterator_traits \ 69 72 */ … … 79 82 }; 80 83 84 /** 85 Convenience wrapper around averager_traits 86 \see weighted_iterator_traits \ 87 */ 88 template <typename Iterator1, typename Iterator2> 89 struct averager_pair 90 { 91 /** 92 Convenience Metafunction taking iterator as argument and return 93 either Averager (if both iterators are unweighted) or AveragerWeighted 94 otherwise. 95 */ 96 typedef typename 97 averager_traits< 98 typename utility::weighted_if_any2<Iterator1, Iterator2>::type 99 >::pair_type type; 100 }; 101 81 102 }}} // of namespace statistics, yat, and theplu 82 103
Note: See TracChangeset
for help on using the changeset viewer.