CVR-Lib last update 20 Sep 2009

cvr::distanceFunctor< T > Class Template Reference

This class is the base class for all functors which compute distances between two vectors or matrices. More...

#include <cvrDistanceFunctor.h>

Inheritance diagram for cvr::distanceFunctor< T >:

Inheritance graph
[legend]
Collaboration diagram for cvr::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 T distance (const vector< T > &a, const vector< T > &b) const
virtual T distance (const matrix< T > &a, const matrix< T > &b) const
virtual bool apply (const vector< T > &a, const vector< T > &b, T &dist) 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
distanceFunctor< T > & copy (const distanceFunctor< T > &other)
virtual const std::string & name () const
virtual distanceFunctor< T > * clone () const =0
virtual distanceFunctor< T > * newInstance () const =0
const parametersgetParameters () const


Detailed Description

template<typename T>
class cvr::distanceFunctor< T >

This class is the base class for all functors which compute distances between two vectors or 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<typename T>
cvr::distanceFunctor< T >::distanceFunctor (  ) 

default constructor

template<typename T>
cvr::distanceFunctor< T >::distanceFunctor ( const distanceFunctor< T > &  other  ) 

copy constructor

Parameters:
other the object to be copied

template<typename T>
virtual cvr::distanceFunctor< T >::~distanceFunctor (  )  [virtual]

destructor


Member Function Documentation

template<typename T>
virtual bool cvr::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 cvr::euclideanDistanceFunctor< T >.

template<typename T>
virtual bool cvr::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 cvr::euclideanDistanceFunctor< T >.

template<typename T>
virtual bool cvr::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 parameter 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 cvr::euclideanDistanceFunctor< T >.

template<typename T>
virtual bool cvr::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 cvr::euclideanDistanceFunctor< T >.

template<typename T>
virtual distanceFunctor<T>* cvr::distanceFunctor< T >::clone (  )  const [pure virtual]

returns a pointer to a clone of this functor.

Implements cvr::functor.

Implemented in cvr::euclideanDistanceFunctor< T >.

template<typename T>
distanceFunctor<T>& cvr::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

template<typename T>
virtual T cvr::distanceFunctor< T >::distance ( const matrix< T > &  a,
const matrix< T > &  b 
) const [virtual]

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

This is a shortcut for apply(const matrix<T>&, const matrix<T>&, T&).

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

template<typename T>
virtual T cvr::distanceFunctor< T >::distance ( const vector< T > &  a,
const vector< T > &  b 
) const [virtual]

returns the distance between the vectors a and b.

This is a shortcut for apply(const vector<T>&, const vector<T>&, T&).

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

template<typename T>
const parameters& cvr::distanceFunctor< T >::getParameters (  )  const

returns used parameters

Reimplemented from cvr::parametersManager.

Reimplemented in cvr::euclideanDistanceFunctor< T >.

template<typename T>
virtual const std::string& cvr::distanceFunctor< T >::name (  )  const [virtual]

Return the name of the class.

Implements cvr::functor.

Reimplemented in cvr::euclideanDistanceFunctor< T >.

template<typename T>
virtual distanceFunctor<T>* cvr::distanceFunctor< T >::newInstance (  )  const [pure virtual]

returns a pointer to a new instance of this functor.

Implements cvr::functor.

Implemented in cvr::euclideanDistanceFunctor< T >.


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

Generated on Sun Sep 20 22:08:57 2009 for CVR-Lib by Doxygen 1.5.8