latest version v1.9 - last update 10 Apr 2010 |
This member accumulates in the given accumulator, the given element. More...
#include <ltiL1Distance.h>
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 |
l1Distance & | copy (const l1Distance &other) |
virtual functor * | clone () const |
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)
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).
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.
lti::l1Distance< T >::l1Distance | ( | ) |
default constructor
lti::l1Distance< T >::l1Distance | ( | const l1Distance< T > & | other | ) |
copy constructor
other | the object to be copied |
virtual lti::l1Distance< T >::~l1Distance | ( | ) | [virtual] |
destructor
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.
m | the matrix<T> | |
v | the vector to be compared with | |
dest | the vector with the distances to the vector v |
Implements lti::distanceFunctor< 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!
a | the first matrix<T> | |
b | the second matrix<T> | |
dist | the L1 distance between a and b |
Implements lti::distanceFunctor< 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!
a | the first matrix<T> | |
b | the second matrix<T> |
Implements lti::distanceFunctor< 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.
a | the first vector<T> | |
b | the second vector<T> | |
dists | the distances between the matrices |
Implements lti::distanceFunctor< 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!
a | the first vector<T> | |
b | the second vector<T> |
Implements lti::distanceFunctor< 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
a | the first vector<T> | |
b | the second vector<T> | |
dist | the distance between the vectors |
Implements lti::distanceFunctor< 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.
m | the matrix<T> |
Implements lti::distanceFunctor< 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.
m | the matrix<T> | |
norm | the 'norm' of the matrix |
Implements lti::distanceFunctor< 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
m | the matrix<T> | |
norms | the norms of the rows/columns |
Implements lti::distanceFunctor< T >.
virtual T lti::l1Distance< T >::apply | ( | const vector< T > & | v | ) | const [virtual] |
calculate the norm of vector v
v | the vector<T> |
Implements lti::distanceFunctor< T >.
virtual bool lti::l1Distance< T >::apply | ( | const vector< T > & | v, | |
T & | norm | |||
) | const [virtual] |
calculate the norm of vector v
v | the vector<T> | |
norm | the norm of the vectors |
Implements lti::distanceFunctor< T >.
virtual functor* lti::l1Distance< T >::clone | ( | ) | const [virtual] |
returns a pointer to a clone of this functor.
Implements lti::distanceFunctor< T >.
l1Distance& lti::l1Distance< T >::copy | ( | const l1Distance< T > & | other | ) |
copy data of "other" functor.
other | the functor to be copied |
Reimplemented from lti::distanceFunctor< T >.
virtual const char* lti::l1Distance< T >::getTypeName | ( | ) | const [virtual] |
returns the name of this type ("l1Distance")
Reimplemented from lti::distanceFunctor< T >.