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

lti::gaussian< T > Class Template Reference

This function evaluates a multivariate gaussian with the form:

\[ g(\mathbf{x}) = \frac{1}{(2\pi)^{n/2} |\boldsymbol{\Sigma}|^{1/2}} \cdot \exp\left(-\frac{1}{2}(\mathbf{x}-\boldsymbol{\mu})^T \boldsymbol{\Sigma}^{-1}(\mathbf{x}-\boldsymbol{\mu})\right)\]

. More...

#include <ltiGaussian.h>

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

List of all members.

Classes

class  parameters
 the parameters for the class gaussian More...

Public Member Functions

 gaussian ()
 gaussian (const T mean, const T variance)
 gaussian (const vector< T > &mean, const matrix< T > &covar)
 gaussian (const gaussian< T > &other)
virtual ~gaussian ()
virtual const char * getTypeName () const
bool apply (const vector< T > &src, T &dest) const
operator() (const vector< T > &vct)
bool apply (const T src, T &dest) const
operator() (const T x)
void setMeanAndCovariance (const vector< T > &mean, const matrix< T > &covar)
void setMeanAndVariance (const T mean, const T variance)
gaussiancopy (const gaussian &other)
gaussianoperator= (const gaussian &other)
virtual functorclone () const
const parametersgetParameters () const
virtual bool updateParameters ()

Protected Attributes

matrix< T > invCovariance
vector< T > meanVct
norm
invVarianceH
mean

Detailed Description

template<class T>
class lti::gaussian< T >

This function evaluates a multivariate gaussian with the form:

\[ g(\mathbf{x}) = \frac{1}{(2\pi)^{n/2} |\boldsymbol{\Sigma}|^{1/2}} \cdot \exp\left(-\frac{1}{2}(\mathbf{x}-\boldsymbol{\mu})^T \boldsymbol{\Sigma}^{-1}(\mathbf{x}-\boldsymbol{\mu})\right)\]

.

The template value T is the type of the container elements (double or float).


Constructor & Destructor Documentation

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

default constructor

template<class T>
lti::gaussian< T >::gaussian ( const T  mean,
const T  variance 
)

Construct a 1D gaussian with the given mean and variance.

Note that the second parameter is the variance and not the standard deviation.

template<class T>
lti::gaussian< T >::gaussian ( const vector< T > &  mean,
const matrix< T > &  covar 
)

construct a n-dimensional gaussian with the given mean vector and covariance matrix.

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

copy constructor

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

destructor


Member Function Documentation

template<class T>
bool lti::gaussian< T >::apply ( const T  src,
T &  dest 
) const

Computes the gaussian for the given scalar, and leave the result in the dest parameter.

This is a shortcut for the 1D case. If the mean and covariance given in the parameters have more the one dimension, the result will not be valid.

Parameters:
src input scalar
dest function value
Returns:
true if apply successful or false otherwise.
template<class T>
bool lti::gaussian< T >::apply ( const vector< T > &  src,
T &  dest 
) const

computes the gaussian for the given vector, and leave the result in the dest parameter.

Parameters:
src vector<T> with the source data.
dest function value
Returns:
true if apply successful or false otherwise.
template<class T>
virtual functor* lti::gaussian< T >::clone (  )  const [virtual]

returns a pointer to a clone of this functor.

Reimplemented from lti::mathFunction.

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

copy data of "other" functor.

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

Reimplemented from lti::mathFunction.

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

returns used parameters

Reimplemented from lti::mathFunction.

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

returns the name of this type ("gaussian")

Reimplemented from lti::mathFunction.

template<class T>
T lti::gaussian< T >::operator() ( const T  x  ) 

Alias for apply.

Parameters:
x input scalar
Returns:
function value
template<class T>
T lti::gaussian< T >::operator() ( const vector< T > &  vct  ) 

alias for apply

Parameters:
vct vector<T> with the source data.
Returns:
function value or negative if error occurred
template<class T>
gaussian& lti::gaussian< T >::operator= ( const gaussian< T > &  other  ) 

alias for copy member

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

Reimplemented from lti::mathFunction.

template<class T>
void lti::gaussian< T >::setMeanAndCovariance ( const vector< T > &  mean,
const matrix< T > &  covar 
)

Shortcut to set the mean vector and covariance matrix.

template<class T>
void lti::gaussian< T >::setMeanAndVariance ( const T  mean,
const T  variance 
)

Shortcut to set a one dimensional gaussian with the mean value and the variance.

template<class T>
virtual bool lti::gaussian< T >::updateParameters (  )  [virtual]

set functor's parameters.

This member makes a copy of theParam: the functor will keep its own copy of the parameters!

Returns:
true if successful, false otherwise

Reimplemented from lti::functor.


Member Data Documentation

template<class T>
matrix<T> lti::gaussian< T >::invCovariance [protected]

inverse of covariance matrix

template<class T>
T lti::gaussian< T >::invVarianceH [protected]

inverse of -2 times the variance for the 1D case

template<class T>
T lti::gaussian< T >::mean [protected]

mean value for the 1D case

template<class T>
vector<T> lti::gaussian< T >::meanVct [protected]

mean vector

template<class T>
T lti::gaussian< T >::norm [protected]

determinant of the covariance matrix


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

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