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

lti::singularValueDecomp< T > Class Template Reference

Singular Value Decomposition. More...

#include <ltiSVD.h>

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

List of all members.

Classes

class  parameters
 the parameters for the class More...

Public Member Functions

 singularValueDecomp ()
 singularValueDecomp (const parameters &params)
 singularValueDecomp (bool sort)
 singularValueDecomp (const singularValueDecomp< T > &other)
virtual ~singularValueDecomp ()
virtual const char * getTypeName () const
singularValueDecompcopy (const singularValueDecomp &other)
virtual functorclone () const
const parametersgetParameters () const
bool decomposition (matrix< T > &src, vector< T > &w, matrix< T > &v) const
virtual bool apply (matrix< T > &src, vector< T > &w, matrix< T > &v) const
virtual bool apply (const matrix< T > &src, matrix< T > &u, vector< T > &w, matrix< T > &v) const

Detailed Description

template<class T>
class lti::singularValueDecomp< T >

Singular Value Decomposition.

The functor will take a matrix A and compute its singular value decomposition, consisting of three matrices U, W, and V, with A=U*W*V' (where V' denotes the transpose of V). U is a column-orthonormal matrix, W is a diagonal matrix with the singular values on the diagonal, and V is a orthonormal matrix. Those columns of V whose corresponding entries in W are zero are the basis of A's null space.

You can find more theoretical information about a similar algorithm in W. H. Press, S. A. Teukolsky, W. T. Vetterling, and B. P. Flannery: Numerical Recipes in C, 2nd edition, Cambridge University Press, 1992.

Only instantiations of floating point types makes sense (i.e. for T double or float). If you want the singular values and corresponding singular vectors to be sorted, you have to set parameters::sort to true.


Constructor & Destructor Documentation

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

default constructor

template<class T>
lti::singularValueDecomp< T >::singularValueDecomp ( const parameters params  ) 

default constructor with parameters

template<class T>
lti::singularValueDecomp< T >::singularValueDecomp ( bool  sort  ) 

constructor.

Sets parameters::sort to the given value.

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

copy constructor

template<class T>
virtual lti::singularValueDecomp< T >::~singularValueDecomp (  )  [virtual]

destructor


Member Function Documentation

template<class T>
virtual bool lti::singularValueDecomp< T >::apply ( const matrix< T > &  src,
matrix< T > &  u,
vector< T > &  w,
matrix< T > &  v 
) const [virtual]

OnCopy version of Singular Value Decomposition.

Parameters:
src matrix<T> with the source matrix
u the U matrix
w vector<T> with the singular values, sorted descendingly if parameters::sort is true. The elements of this vector constitute the diagonal of the W matrix.
v the V matrix
Returns:
true is the decomposition was successfull, false if an error occured

Reimplemented in lti::fastSVD< T >.

template<class T>
virtual bool lti::singularValueDecomp< T >::apply ( matrix< T > &  src,
vector< T > &  w,
matrix< T > &  v 
) const [virtual]

OnPlace version of Singular Value Decomposition.

Parameters:
src matrix<T> with the source matrix, will also contain the U matrix after the function has returned.
w vector<T> with the singular values, sorted descendingly if parameters::sort is true. The elements of this vector constitute the diagonal of the W matrix.
v the V matrix
Returns:
true is the decomposition was successfull, false if an error occured

Reimplemented in lti::fastSVD< T >.

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

returns a pointer to a clone of this functor.

Implements lti::functor.

Reimplemented in lti::fastSVD< T >.

template<class T>
singularValueDecomp& lti::singularValueDecomp< T >::copy ( const singularValueDecomp< 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.

template<class T>
bool lti::singularValueDecomp< T >::decomposition ( matrix< T > &  src,
vector< T > &  w,
matrix< T > &  v 
) const

OnPlace version of Singular Value Decomposition.

Singular Value Decomposition means that a m*n-matrix A is decomposed into three matrices U,W,V, such that A = U*W*V'. U is m*n, W is a diagonal matrix with n elements (which is implemented as vector), V is a n*n-matrix. Note that the function returns V, not V'.

Parameters:
src matrix<T> with the source matrix, will also contain the U matrix after the function has returned. If src is a m*n matrix, U will also be of size m*n
w vector<T> with the singular values, sorted descendingly The elements of this vector constitute the diagonal of the W matrix.
v the V matrix
Returns:
true is the decomposition was successfull, false if an error occured
template<class T>
const parameters& lti::singularValueDecomp< T >::getParameters (  )  const

returns used parameters

Reimplemented from lti::functor.

Reimplemented in lti::fastSVD< T >.

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

returns the name of this type ("singularValueDecomp")

Reimplemented from lti::linearAlgebraFunctor.

Reimplemented in lti::fastSVD< T >.


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

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