yat  0.8.3pre
Distance

Description

Distance is a concept for classes implementing different alternatives to calculate the distance between two points.

Requirements

Classes modelling the concept Distance should have a copy constructor

Distance(const Distance& d);

and also implement the following public function:

template<typename Iter1, typename Iter2>
double  operator() (Iter1 beg1, Iter1 end1, Iter2 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 of the category std::forward_iterator. The function should provide both a fast calculation for unweighted iterators and a calculation for weighted iterators. The latter correspond to the case where elements in a range have both a value and a weight. The selection between unweighted and weighted implementations should utilize theplu::yat::utility::unweighted_iterator_tag and theplu::yat::utility::weighted_iterator_tag. Moreover theplu::yat::utility::weighted_if_any2 should be utilized to provide a weighted implementation if any of the two ranges is weighted, and an unweighted implementation when both ranges are unweighted.

Implementations

Examples of classes modelling the concept Distance include theplu::yat::statistics::PearsonDistance and theplu::yat::statistics::EuclideanDistance.

See also:
Weighted Distance

Generated on Thu Dec 20 2012 03:12:58 for yat by  doxygen 1.8.0-20120409