Changeset 3531
- Timestamp:
- Oct 11, 2016, 10:05:10 AM (7 years ago)
- Location:
- trunk/yat/statistics
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/yat/statistics/EuclideanDistance.h
r2202 r3531 33 33 namespace yat { 34 34 namespace statistics { 35 35 36 36 /// 37 37 /// @brief Calculates the Euclidean distance between two points 38 /// given by elements of ranges. 38 /// given by elements of ranges. 39 39 /// 40 40 /// This class is modelling the concept \ref concept_distance. … … 42 42 /// 43 43 struct EuclideanDistance 44 { 44 { 45 45 /** 46 46 \brief Calculates the Euclidean distance between elements of 47 47 two ranges. 48 48 49 49 If elements of both ranges are unweighted the distance is 50 50 calculated as \f$ \sqrt{\sum (x_i-y_i)^2 } \f$, where \f$ x_i … … 62 62 */ 63 63 template <typename ForwardIterator1, typename ForwardIterator2> 64 double operator()(ForwardIterator1 beg1, ForwardIterator1 end1, 64 double operator()(ForwardIterator1 beg1, ForwardIterator1 end1, 65 65 ForwardIterator2 beg2) const 66 66 { 67 67 using utility::weighted_if_any2; 68 typename weighted_if_any2<ForwardIterator1,ForwardIterator2>::type tag; 69 return this->distance(beg1, end1, beg2, tag); 68 typename weighted_if_any2<ForwardIterator1,ForwardIterator2>::type tag; 69 return this->distance(beg1, end1, beg2, tag); 70 70 } 71 71 72 72 private: 73 73 template <typename Iter1, typename Iter2> 74 double distance (Iter1 beg1,Iter1 end1, Iter2 beg2, 74 double distance (Iter1 beg1,Iter1 end1, Iter2 beg2, 75 75 utility::unweighted_iterator_tag) const 76 76 { … … 81 81 82 82 template <typename Iter1, typename Iter2> 83 double distance (Iter1 beg1,Iter1 end1, Iter2 beg2, 83 double distance (Iter1 beg1,Iter1 end1, Iter2 beg2, 84 84 utility::weighted_iterator_tag) const 85 85 { … … 88 88 return sqrt(std::distance(beg1,end1)*ap.msd()); 89 89 } 90 90 91 91 }; 92 92 93 93 }}} // of namespace statistics, yat, and theplu 94 94 95 95 #endif -
trunk/yat/statistics/PearsonDistance.h
r2202 r3531 32 32 33 33 /// 34 /// @brief Calculates the %Pearson correlation distance between two points given by elements of ranges. 34 /// @brief Calculates the %Pearson correlation distance between two points given by elements of ranges. 35 35 /// 36 36 /// This class is modelling the concept \ref concept_distance. … … 41 41 \brief Calculates the %Pearson correlation distance between 42 42 elements of two ranges. 43 43 44 44 If elements of both ranges are unweighted the distance is 45 45 calculated as \f$ 1-\mbox{C}(x,y) \f$, where \f$ x \f$ and \f$ … … 55 55 two ranges are unweighted, the weights for these elements are 56 56 set to unity. 57 */ 57 */ 58 58 template <typename ForwardIterator1, typename ForwardIterator2> 59 double operator()(ForwardIterator1 beg1, ForwardIterator1 end1, 59 double operator()(ForwardIterator1 beg1, ForwardIterator1 end1, 60 60 ForwardIterator2 beg2) const 61 61 { … … 67 67 68 68 }}} // of namespace statistics, yat, and theplu 69 69 70 70 #endif
Note: See TracChangeset
for help on using the changeset viewer.