yat
0.17pre

Distance is a concept for classes implementing different alternatives to calculate the distance between two ranges. For details on requirements needed for a class modelling the concept Distance refer to section below, but a convenient way to implement a class is to use class theplu::yat::statistics::Distance as base class.
Classes modelling the concept Distance should have a copy constructor
Distance(const Distance& d);
and also implement the following public function:
template<typename Iterator1, typename Iterator2> double operator() (Iterator1 beg1, Iterator1 end1, Iterator2 beg2) const
This function should calculate and return the distance between elements of two ranges. The first range is given by [beg1, end1) and the second range starts with beg2 and has the same length as the first range. The function should support iterators that model Data Iterator and Forward Traversal Iterator, in other words, the function should not assume any functionality not guaranteed by concepts Forward Traversal Iterator and Readable Iterator.
As Data Iterator should be supported, class should support Weighted Iterator. Typically a Distance class has a fast calculation for the case when neither of the two input ranges is weighted, and a separate function taking care of weights. A convenient way to select between unweighted and weighted implementations is to utilize tag structs theplu::yat::utility::unweighted_iterator_tag and theplu::yat::utility::weighted_iterator_tag as returned from metafunction theplu::yat::utility::weighted_if_any2.
The class theplu::yat::utility::DistanceConcept an be used to test that a class fulfills these requirements.
Examples of classes modelling the concept Distance include theplu::yat::statistics::PearsonDistance and theplu::yat::statistics::EuclideanDistance.