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

lti::l2Distance< T > Class Template Reference
[Linear Algebra]

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

#include <ltiL2Distance.h>

Inheritance diagram for lti::l2Distance< T >:
Inheritance graph
[legend]
Collaboration diagram for lti::l2Distance< T >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 l2Distance ()
 l2Distance (const l2Distance &other)
virtual ~l2Distance ()
virtual const char * getTypeName () const
virtual bool apply (const vector< T > &v, T &norm) const
virtual T apply (const vector< T > &v) const
virtual bool apply (const matrix< T > &m, vector< T > &norms) const
virtual bool apply (const matrix< T > &m, T &norm) const
virtual T apply (const matrix< T > &m) const
virtual bool apply (const vector< T > &a, const vector< T > &b, T &dist) const
virtual T apply (const vector< T > &a, const vector< T > &b) const
virtual bool apply (const matrix< T > &a, const matrix< T > &b, vector< T > &dists) const
virtual T apply (const matrix< T > &a, const matrix< T > &b) const
virtual bool apply (const matrix< T > &a, const matrix< T > &b, T &dist) const
virtual bool apply (const matrix< T > &m, const vector< T > &v, vector< T > &dest) const
l2Distancecopy (const l2Distance &other)
virtual functorclone () const

Detailed Description

template<class T>
class lti::l2Distance< T >

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 l2Distantor this is just acc+=(elem*elem).

Parameters:
element component of the difference between two points.
accumulator variable where the elements will be accumulated. 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 l2Distantor this is just acc+=((elem2-elem1)^2).

Parameters:
element1 component of the first point
element2 component of the second point
accumulator variable where the elements will be accumulated. Compute from the given accumulator the desired distance 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) 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*dist) 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 less than the given distance. So you check accLessThan(accumulator,distance)

For this norm it computes acc > (dist*dist) This class computes the L2 distance between two vectors or matrices or the L2 norm of a vector.

For other aggregate classes like points and rgbPixels, you can use the global functions lti::distanceSqr(), which return the square of the euclidian distance (L2 distance) between the two n-dimensional point representations. That function exists also for vectors to provide a unified interface.


Constructor & Destructor Documentation

template<class T>
lti::l2Distance< T >::l2Distance (  ) 

default constructor

template<class T>
lti::l2Distance< T >::l2Distance ( const l2Distance< T > &  other  ) 

copy constructor

Parameters:
other the object to be copied
template<class T>
virtual lti::l2Distance< T >::~l2Distance (  )  [virtual]

destructor


Member Function Documentation

template<class T>
virtual bool lti::l2Distance< T >::apply ( const matrix< T > &  m,
const vector< T > &  v,
vector< T > &  dest 
) const [virtual]

Calculate the distance between each row or column of m depending on the value of rowWise and the vector v.

Parameters:
m the matrix<T>
v the vector to be compared with
dest the vector with the distances to the vector v
Returns:
false on error

Implements lti::distanceFunctor< T >.

template<class T>
virtual bool lti::l2Distance< T >::apply ( const matrix< T > &  a,
const matrix< T > &  b,
T &  dist 
) const [virtual]

calculate the L2 distance between the matrices a and b If both matrices have different sizes, the returned value will be negative!

Parameters:
a the first matrix<T>
b the second matrix<T>
dist the L2 distance between a and b
Returns:
false on error

Implements lti::distanceFunctor< T >.

template<class T>
virtual T lti::l2Distance< T >::apply ( const matrix< T > &  a,
const matrix< T > &  b 
) const [virtual]

calculate the L2 distance between the matrices a and b If both matrices have different sizes, the returned value will be negative!

Parameters:
a the first matrix<T>
b the second matrix<T>
Returns:
the L2 distance between a and b

Implements lti::distanceFunctor< T >.

template<class T>
virtual bool lti::l2Distance< T >::apply ( const matrix< T > &  a,
const matrix< T > &  b,
vector< T > &  dists 
) const [virtual]

calculate the distances between the rows or columns of the matrices a and b, determined by the parameters rowWise.

Parameters:
a the first vector<T>
b the second vector<T>
dists the distances between the matrices
Returns:
false on error -> see status string

Implements lti::distanceFunctor< T >.

template<class T>
virtual T lti::l2Distance< T >::apply ( const vector< T > &  a,
const vector< T > &  b 
) const [virtual]

calculates the L2 distance between the vectors a and b If both vectors have different sizes, the returned value will be negative!

Parameters:
a the first vector<T>
b the second vector<T>
Returns:
the L2 distance between a and b

Implements lti::distanceFunctor< T >.

template<class T>
virtual bool lti::l2Distance< T >::apply ( const vector< T > &  a,
const vector< T > &  b,
T &  dist 
) const [virtual]

calculate the distance between the vectors a and b

Parameters:
a the first vector<T>
b the second vector<T>
dist the distance between the vectors
Returns:
false on error -> see status string

Implements lti::distanceFunctor< T >.

template<class T>
virtual T lti::l2Distance< T >::apply ( const matrix< T > &  m  )  const [virtual]

calculate something like the norm of the matrix: the matrix is seen as a vector.

Parameters:
m the matrix<T>
Returns:
the 'norm' of the matrix

Implements lti::distanceFunctor< T >.

template<class T>
virtual bool lti::l2Distance< T >::apply ( const matrix< T > &  m,
T &  norm 
) const [virtual]

calculate something like the norm of the matrix: the matrix is seen as a vector.

Parameters:
m the matrix<T>
norm the 'norm' of the matrix
Returns:
false on error

Implements lti::distanceFunctor< T >.

template<class T>
virtual bool lti::l2Distance< T >::apply ( const matrix< T > &  m,
vector< T > &  norms 
) const [virtual]

calculate the norms of rows or columns of the matrix

Parameters:
m the matrix<T>
norms the norms of the rows/columns
Returns:
false on error

Implements lti::distanceFunctor< T >.

template<class T>
virtual T lti::l2Distance< T >::apply ( const vector< T > &  v  )  const [virtual]

calculate the norm of vector v

Parameters:
v the vector<T>
Returns:
the norm of the vector

Implements lti::distanceFunctor< T >.

template<class T>
virtual bool lti::l2Distance< T >::apply ( const vector< T > &  v,
T &  norm 
) const [virtual]

calculate the norm of vector v

Parameters:
v the vector<T>
norm the norm of the vectors
Returns:
false on error

Implements lti::distanceFunctor< T >.

Referenced by lti::SOFM2DVisualizer::uMatrix().

template<class T>
virtual functor* lti::l2Distance< T >::clone (  )  const [virtual]

returns a pointer to a clone of this functor.

Implements lti::distanceFunctor< T >.

template<class T>
l2Distance& lti::l2Distance< T >::copy ( const l2Distance< T > &  other  ) 

copy data of "other" functor.

Parameters:
other the functor to be copied
Returns:
a reference to this functor object

Reimplemented from lti::distanceFunctor< T >.

template<class T>
virtual const char* lti::l2Distance< T >::getTypeName (  )  const [virtual]

returns the name of this type ("l2Distance")

Reimplemented from lti::distanceFunctor< T >.


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

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