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

lti::meansFunctor< T > Class Template Reference
[Basic Statistics]

Functor which computes several kinds of means for vectors and matrices. More...

#include <ltiMeansFunctor.h>

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

List of all members.

Classes

class  parameters
 the parameters for the class meansFunctor More...

Public Member Functions

 meansFunctor ()
 meansFunctor (const meansFunctor &other)
virtual ~meansFunctor ()
virtual const char * getTypeName () const
apply (const vector< T > &src) const
geometricMean (const vector< T > &src) const
arithmeticMean (const vector< T > &src) const
T & apply (const vector< T > &src, T &dest) const
T & arithmeticMean (const vector< T > &src, T &dest) const
T & geometricMean (const vector< T > &src, T &dest) const
vector< T > & apply (const matrix< T > &src, vector< T > &dest) const
void meanOfRows (const matrix< T > &src, vector< T > &dest) const
void geometricMeanOfRows (const matrix< T > &src, vector< T > &dest) const
void arithmeticMeanOfRows (const matrix< T > &src, vector< T > &dest) const
void meanOfColumns (const matrix< T > &src, vector< T > &dest) const
void arithmeticMeanOfColumns (const matrix< T > &src, vector< T > &dest) const
void geometricMeanOfColumns (const matrix< T > &src, vector< T > &dest) const
meansFunctorcopy (const meansFunctor &other)
virtual functorclone () const
const parametersgetParameters () const

Detailed Description

template<class T>
class lti::meansFunctor< T >

Functor which computes several kinds of means for vectors and matrices.

Be careful with the terms used here. If you have following matrix

 |  5  6  10  3 |
 |  1 -2   4  5 |
 |  3  2   1 -2 |

The meanOfRows means the mean of all rows, i.e. a row vector containing (for the arithmetical mean) the sum of all row vectors divided by the number of rows. This is (3 2 5 2).

The meanOfColumns means the mean of all columns, i.e. a column vector containing (for the arithmetical mean) the sum of all column vectors divided by the number of columns. This is (6 2 1)^T.

The parameter parameters::rowWise indicates that the matrix will be seen as a set of row vectors (if true), or column vectors (false).


Constructor & Destructor Documentation

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

default constructor

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

copy constructor

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

destructor


Member Function Documentation

template<class T >
vector<T>& lti::meansFunctor< T >::apply ( const matrix< T > &  src,
vector< T > &  dest 
) const

The result of this function depends on the value of parameters::rowWise.

If this parameter is true, the functor will compute a vector, whose elements contain each the mean of one column of the matrix (the computes the mean of the rows, where each row is a data point in n-dimensional space. if rowWise is false, the result vector contains the mean of the columns of the matrix (each column a data point). The type of the mean (arithmetic or geometric) is determined by the value of parameters::geometric. For the geometric mean we take the square root of the absolute value of the product of all elements.

Parameters:
src matrix<T> with the source data.
dest matrix<T> where the result will be left.
Returns:
a reference to the dest.
template<class T >
T& lti::meansFunctor< T >::apply ( const vector< T > &  src,
T &  dest 
) const

computes the mean of the given vector.

The type of the mean (arithmetic or geometric) is determined by the parameter parameters::geometric. For geometric mean we take the square root of the absolute value of the product of all elements.

Parameters:
src vector<T> with the source data.
dest T where the result will be left.
Returns:
a reference to the dest.
template<class T >
T lti::meansFunctor< T >::apply ( const vector< T > &  src  )  const

returns the mean of the given vector.

The type of the mean (arithmetic or geometric) is determined by the parameter parameters::geometric

Parameters:
src vector<T> with the source data.
Returns:
the result.
template<class T >
T& lti::meansFunctor< T >::arithmeticMean ( const vector< T > &  src,
T &  dest 
) const

computes the arithmetic mean of the given vector.

Parameters:
src vector<T> with the source data.
dest T where the result will be left.
Returns:
a reference to the dest.
template<class T >
T lti::meansFunctor< T >::arithmeticMean ( const vector< T > &  src  )  const

returns the arithmetic mean of the given vector.

Parameters:
src vector<T> with the source data.
Returns:
the arithmetic mean of the elements of src.
template<class T >
void lti::meansFunctor< T >::arithmeticMeanOfColumns ( const matrix< T > &  src,
vector< T > &  dest 
) const

The result vector contains the arithmetic mean of the columns of the matrix (each column a data point).

Parameters:
src matrix<T> with the source data.
dest matrix<T> where the result will be left.
template<class T >
void lti::meansFunctor< T >::arithmeticMeanOfRows ( const matrix< T > &  src,
vector< T > &  dest 
) const

This function will compute a vector, whose elements contain each the arithmetic mean of one column of the matrix (the method computes the mean of the rows, where each row is a data point in n-dimensional space).

Parameters:
src matrix<T> with the source data.
dest matrix<T> where the result will be left.
template<class T >
virtual functor* lti::meansFunctor< T >::clone (  )  const [virtual]

returns a pointer to a clone of this functor.

Reimplemented from lti::statisticsFunctor.

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

copy data of "other" functor.

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

Reimplemented from lti::statisticsFunctor.

template<class T >
T& lti::meansFunctor< T >::geometricMean ( const vector< T > &  src,
T &  dest 
) const

computes the geometric mean of the given vector.

For convenience we take the square root of the absolute value of the product of all elements.

Parameters:
src vector<T> with the source data.
dest T where the result will be left.
Returns:
a reference to the dest.
template<class T >
T lti::meansFunctor< T >::geometricMean ( const vector< T > &  src  )  const

returns the geometric mean of the given vector.

For convenience we take the square root of the absolute value of the product of all elements.

Parameters:
src vector<T> with the source data.
Returns:
the geometric mean of the elements of src.
template<class T >
void lti::meansFunctor< T >::geometricMeanOfColumns ( const matrix< T > &  src,
vector< T > &  dest 
) const

The result vector contains the geometric mean of the columns of the matrix (each column a data point).

For convenience we take the square root of the absolute value of the product of all elements.

Parameters:
src matrix<T> with the source data.
dest matrix<T> where the result will be left.
template<class T >
void lti::meansFunctor< T >::geometricMeanOfRows ( const matrix< T > &  src,
vector< T > &  dest 
) const

This function will compute a vector, whose elements contain each the geometric mean of one column of the matrix (the method computes the mean of the rows, where each row is a data point in n-dimensional space).

Parameters:
src matrix<T> with the source data.
dest matrix<T> where the result will be left.
template<class T >
const parameters& lti::meansFunctor< T >::getParameters (  )  const

returns used parameters

Reimplemented from lti::statisticsFunctor.

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

returns the name of this type ("meansFunctor")

Reimplemented from lti::statisticsFunctor.

template<class T >
void lti::meansFunctor< T >::meanOfColumns ( const matrix< T > &  src,
vector< T > &  dest 
) const

The result vector contains the mean of the columns of the matrix (each column a data point).

The type of the mean (arithmetic or geometric) is determined by the value of parameters::geometric. For the geometric mean we take the square root of the absolute value of the product of all elements.

Parameters:
src matrix<T> with the source data.
dest matrix<T> where the result will be left.
template<class T >
void lti::meansFunctor< T >::meanOfRows ( const matrix< T > &  src,
vector< T > &  dest 
) const

This function will compute a vector, whose elements contain each the mean of one column of the matrix (the method computes the mean of the rows, where each row is a data point in n-dimensional space).

The type of the mean (arithmetic or geometric) is determined by the value of parameters::geometric. For the geometric mean we take the square root of the absolute value of the product of all elements.

Parameters:
src matrix<T> with the source data.
dest matrix<T> where the result will be left.

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

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