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

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

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

#include <ltiL1Distance.h>

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

List of all members.

Public Member Functions

 l1Distance ()
 l1Distance (const l1Distance< T > &other)
virtual ~l1Distance ()
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
l1Distancecopy (const l1Distance &other)
virtual functorclone () const

Detailed Description

template<class T>
class lti::l1Distance< 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 l1Distantor this is just acc+=abs(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 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. 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 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 This class computes the L1 distance between two vectors or matrices or the L1 norm of a vector.


Constructor & Destructor Documentation

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

default constructor

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

copy constructor

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

destructor


Member Function Documentation

template<class T>
virtual bool lti::l1Distance< 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::l1Distance< T >::apply ( const matrix< T > &  a,
const matrix< T > &  b,
T &  dist 
) const [virtual]

calculate the L1 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 L1 distance between a and b
Returns:
false on error

Implements lti::distanceFunctor< T >.

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

calculate the L1 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 L1 distance between a and b

Implements lti::distanceFunctor< T >.

template<class T>
virtual bool lti::l1Distance< 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::l1Distance< T >::apply ( const vector< T > &  a,
const vector< T > &  b 
) const [virtual]

calculates the L1 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 L1 distance between a and b

Implements lti::distanceFunctor< T >.

template<class T>
virtual bool lti::l1Distance< 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::l1Distance< 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::l1Distance< 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::l1Distance< 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::l1Distance< 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::l1Distance< 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 >.

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

returns a pointer to a clone of this functor.

Implements lti::distanceFunctor< T >.

template<class T>
l1Distance& lti::l1Distance< T >::copy ( const l1Distance< 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::l1Distance< T >::getTypeName (  )  const [virtual]

returns the name of this type ("l1Distance")

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