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

lti::distanceFunctor< T > Class Template Reference

This class is the base class for all functors which compute distances between two vectors or matrices as well as norms of vectors and matrices. More...

#include <ltiDistanceFunctor.h>

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

List of all members.

Classes

class  parameters
 the parameters for the class distanceFunctor More...

Public Member Functions

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

Detailed Description

template<class T>
class lti::distanceFunctor< T >

This class is the base class for all functors which compute distances between two vectors or matrices as well as norms of vectors and matrices.

See also:
similarityFunctor

Be careful with the use of the parameters::rowWise. It indicates if the matrix should be considered as having row vectors (true) of columns vectors (false). Depending on that the computations will be very different.


Constructor & Destructor Documentation

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

default constructor

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

copy constructor

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

destructor


Member Function Documentation

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

calculate something like the distance between the matrices a and b: both matrices are seen as vectors.

Parameters:
a the first matrix<T>
b the second matrix<T>
Returns:
the 'distance' between the matrices

Implemented in lti::earthMoversDistance< W, C, D >, lti::l1Distance< T >, lti::l2Distance< T >, and lti::l2Distance< double >.

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

calculate something like the distance between the matrices a and b: both matrices are seen as vectors.

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

Implemented in lti::earthMoversDistance< W, C, D >, lti::l1Distance< T >, lti::l2Distance< T >, and lti::l2Distance< double >.

template<class T>
virtual bool lti::distanceFunctor< T >::apply ( const matrix< T > &  m,
const vector< T > &  v,
vector< T > &  dest 
) const [pure 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

Implemented in lti::earthMoversDistance< W, C, D >, lti::l1Distance< T >, lti::l2Distance< T >, and lti::l2Distance< double >.

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

Implemented in lti::earthMoversDistance< W, C, D >, lti::l1Distance< T >, lti::l2Distance< T >, and lti::l2Distance< double >.

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

calculate the distance between the vectors a and b

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

Implemented in lti::earthMoversDistance< W, C, D >, lti::l1Distance< T >, lti::l2Distance< T >, and lti::l2Distance< double >.

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

Implemented in lti::earthMoversDistance< W, C, D >, lti::l1Distance< T >, lti::l2Distance< T >, and lti::l2Distance< double >.

template<class T>
virtual T lti::distanceFunctor< T >::apply ( const matrix< T > &  m  )  const [pure 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

Implemented in lti::earthMoversDistance< W, C, D >, lti::l1Distance< T >, lti::l2Distance< T >, and lti::l2Distance< double >.

template<class T>
virtual bool lti::distanceFunctor< T >::apply ( const matrix< T > &  m,
T &  norm 
) const [pure 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

Implemented in lti::earthMoversDistance< W, C, D >, lti::l1Distance< T >, lti::l2Distance< T >, and lti::l2Distance< double >.

template<class T>
virtual bool lti::distanceFunctor< T >::apply ( const matrix< T > &  m,
vector< T > &  norms 
) const [pure 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

Implemented in lti::earthMoversDistance< W, C, D >, lti::l1Distance< T >, lti::l2Distance< T >, and lti::l2Distance< double >.

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

calculate the norm of vector v

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

Implemented in lti::earthMoversDistance< W, C, D >, lti::l1Distance< T >, lti::l2Distance< T >, and lti::l2Distance< double >.

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

calculate the norm of vector v.

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

Implemented in lti::earthMoversDistance< W, C, D >, lti::l1Distance< T >, lti::l2Distance< T >, and lti::l2Distance< double >.

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

returns a pointer to a clone of this functor.

Implements lti::functor.

Implemented in lti::earthMoversDistance< W, C, D >, lti::l1Distance< T >, lti::l2Distance< T >, and lti::l2Distance< double >.

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

copy data of "other" functor.

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

Reimplemented from lti::functor.

Reimplemented in lti::earthMoversDistance< W, C, D >, lti::l1Distance< T >, and lti::l2Distance< T >.

template<class T>
const parameters& lti::distanceFunctor< T >::getParameters (  )  const

returns used parameters

Reimplemented from lti::functor.

Reimplemented in lti::earthMoversDistance< W, C, D >.

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

returns the name of this type ("distanceFunctor")

Reimplemented from lti::linearAlgebraFunctor.

Reimplemented in lti::earthMoversDistance< W, C, D >, lti::l1Distance< T >, lti::l2Distance< T >, and lti::l2Distance< double >.


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

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