yat  0.8.3pre
Public Member Functions
theplu::yat::statistics::EuclideanDistance Struct Reference

Calculates the Euclidean distance between two points given by elements of ranges. More...

#include <yat/statistics/EuclideanDistance.h>

List of all members.

Public Member Functions

template<typename ForwardIterator1 , typename ForwardIterator2 >
double operator() (ForwardIterator1 beg1, ForwardIterator1 end1, ForwardIterator2 beg2) const
 Calculates the Euclidean distance between elements of two ranges.

Detailed Description

Calculates the Euclidean distance between two points given by elements of ranges.

This class is modelling the concept Distance.


Member Function Documentation

template<typename ForwardIterator1 , typename ForwardIterator2 >
double theplu::yat::statistics::EuclideanDistance::operator() ( ForwardIterator1  beg1,
ForwardIterator1  end1,
ForwardIterator2  beg2 
) const
inline

Calculates the Euclidean distance between elements of two ranges.

If elements of both ranges are unweighted the distance is calculated as $ \sqrt{\sum (x_i-y_i)^2 } $, where $ x_i $ and $ y_i $ are elements of the first and second range, respectively.

If elements of one or both of ranges have weights the distance is calculated as $ \sqrt{N \sum w_{x,i}w_{y,i}(x_i-y_i)^2/\sum w_{x,i}w_{y,i}} $, where $ N $ is the number of elements in the two ranges and $ w_x $ and $ w_y $ are weights for the elements of the first and the second range, respectively. If the elements of one of the two ranges are unweighted, the weights for these elements are set to unity.


The documentation for this struct was generated from the following file:

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