Ignore:
Timestamp:
May 15, 2008, 12:44:30 AM (13 years ago)
Author:
Peter
Message:

adding a similar AveragerPair? traits and using it in PearsonDistance? to simplify the code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/statistics/PearsonDistance.h

    r1275 r1306  
    2626*/
    2727
    28 #include "AveragerPair.h"
    29 #include "AveragerPairWeighted.h"
     28#include "averager_traits.h"
    3029#include "yat/utility/iterator_traits.h"
    3130
     
    6362    (Iter1 beg1,Iter1 end1, Iter2 beg2) const
    6463    {
    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;
    7565      add(ap,beg1,end1,beg2);
    7666      return 1-ap.correlation();
    7767    }
    78 
    79     template <typename Iter1, typename Iter2>
    80     double distance (Iter1 beg1,Iter1 end1, Iter2 beg2,
    81                      utility::weighted_iterator_tag) const
    82     {
    83       AveragerPairWeighted ap;
    84       add(ap,beg1,end1,beg2);
    85       return 1-ap.correlation();
    86     }
    87    
    8868  };
    8969
Note: See TracChangeset for help on using the changeset viewer.