LTI-Lib latest version v1.9 - last update 10 Apr 2010

lti::l1Distantor< T, D > Class Template Reference

Policy class used by several classifiers/trees to measure the distance between two points of type T. More...

#include <ltiL1Distance.h>

List of all members.

Public Types

typedef D distance_type

Public Member Functions

distance_type operator() (const T &a, const T &b) const
Special methods for Minkowski distances



void accumulate (const distance_type element, distance_type &accumulator) const
void accumulate (const typename T::value_type element1, const typename T::value_type element2, distance_type &accumulator) const
distance_type computeDistance (const distance_type &accumulator) const
distance_type component (const typename T::value_type element1, const typename T::value_type element2) const
bool accLessThan (const distance_type acc, const distance_type dist) const
bool accGreaterThan (const distance_type acc, const distance_type dist) const

Detailed Description

template<class T, class D = typename distanceType<T>::distance_type>
class lti::l1Distantor< T, D >

Policy class used by several classifiers/trees to measure the distance between two points of type T.

The type T MUST define the value_type type, which exist for example for vectors, (t)points and (t)rgbPixels.


Member Typedef Documentation

template<class T , class D = typename distanceType<T>::distance_type>
typedef D lti::l1Distantor< T, D >::distance_type

type returned by the distantor


Member Function Documentation

template<class T , class D = typename distanceType<T>::distance_type>
bool lti::l1Distantor< T, D >::accGreaterThan ( const distance_type  acc,
const distance_type  dist 
) const [inline]

Return true if the given partial computed from accumulator is greater than the given distance.

Assume you have accumulated acc until now, and you want to check if the partial distance derived from this accumulator is greater than the given distance. So you check accLessThan(accumulator,distance)

For this norm it computes acc > dist

template<class T , class D = typename distanceType<T>::distance_type>
bool lti::l1Distantor< T, D >::accLessThan ( const distance_type  acc,
const distance_type  dist 
) const [inline]

Return true if the given partial computed from accumulator is less than the given distance.

Assume you have accumulated acc until now, and you want to check if the partial distance derived from this accumulator is less than the given distance. So you check accLessThan(accumulator,distance)

For this norm it computes acc < dist

template<class T , class D = typename distanceType<T>::distance_type>
void lti::l1Distantor< T, D >::accumulate ( const typename T::value_type  element1,
const typename T::value_type  element2,
distance_type accumulator 
) const [inline]

This member accumulates in the given accumulator, the difference of the given elements.

It can be used when the distance need to be computed manually, but using a distantor to still allow the flexibility of changing distances.

For the l1Distantor this is just acc += abs(elem1-elem2).

Parameters:
element1 component of the first point
element2 component of the second point
accumulator variable where the elements will be accumulated.

References lti::abs().

template<class T , class D = typename distanceType<T>::distance_type>
void lti::l1Distantor< T, D >::accumulate ( const distance_type  element,
distance_type accumulator 
) const [inline]

This member accumulates in the given accumulator, the given element.

It can be used when the distance need to be computed manually, but using a distantor to still allow the flexibility of changing distances.

For the l1Distantor this is just acc+=abs(elem)

Parameters:
element component of the difference between two points.
accumulator variable where the elements will be accumulated.

References lti::abs().

template<class T , class D = typename distanceType<T>::distance_type>
distance_type lti::l1Distantor< T, D >::component ( const typename T::value_type  element1,
const typename T::value_type  element2 
) const [inline]

return the distance between two components, which is in some way a component of the total distance (that is the reason for the name).

For this distantor it return abs(element2-element1)

References lti::abs().

template<class T , class D = typename distanceType<T>::distance_type>
distance_type lti::l1Distantor< T, D >::computeDistance ( const distance_type accumulator  )  const [inline]

Compute from the given accumulator the desired distance.

template<class T , class D = typename distanceType<T>::distance_type>
distance_type lti::l1Distantor< T, D >::operator() ( const T &  a,
const T &  b 
) const [inline]

compute the distance between a and b

References lti::cityBlockDistance().


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

Generated on Sat Apr 10 15:28:26 2010 for LTI-Lib by Doxygen 1.6.1