latest version v1.9 - last update 10 Apr 2010 |
Singular Value Decomposition. More...
#include <ltiSVD.h>
Classes | |
class | parameters |
the parameters for the class More... | |
Public Member Functions | |
singularValueDecomp () | |
singularValueDecomp (const parameters ¶ms) | |
singularValueDecomp (bool sort) | |
singularValueDecomp (const singularValueDecomp< T > &other) | |
virtual | ~singularValueDecomp () |
virtual const char * | getTypeName () const |
singularValueDecomp & | copy (const singularValueDecomp &other) |
virtual functor * | clone () const |
const parameters & | getParameters () 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 |
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.
lti::singularValueDecomp< T >::singularValueDecomp | ( | ) |
default constructor
lti::singularValueDecomp< T >::singularValueDecomp | ( | const parameters & | params | ) |
default constructor with parameters
lti::singularValueDecomp< T >::singularValueDecomp | ( | bool | sort | ) |
constructor.
Sets parameters::sort to the given value.
lti::singularValueDecomp< T >::singularValueDecomp | ( | const singularValueDecomp< T > & | other | ) |
copy constructor
virtual lti::singularValueDecomp< T >::~singularValueDecomp | ( | ) | [virtual] |
destructor
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.
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 |
Reimplemented in lti::fastSVD< T >.
virtual bool lti::singularValueDecomp< T >::apply | ( | matrix< T > & | src, | |
vector< T > & | w, | |||
matrix< T > & | v | |||
) | const [virtual] |
OnPlace version of Singular Value Decomposition.
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 |
Reimplemented in lti::fastSVD< 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 >.
singularValueDecomp& lti::singularValueDecomp< T >::copy | ( | const singularValueDecomp< T > & | other | ) |
copy data of "other" functor.
other | the functor to be copied |
Reimplemented from lti::functor.
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'.
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 |
const parameters& lti::singularValueDecomp< T >::getParameters | ( | ) | const |
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 >.