Honeycomb  0.1
Component-Model Framework
Public Types | Public Member Functions | List of all members
honey::Svd< Real > Class Template Reference

Singular Value Decomposition. Can be used to calculate the pseudo-inverse of any matrix or solve least squares problems. More...

#include <Base.h>

Public Types

enum  Mode { Mode::full, Mode::reduced }
 
typedef Matrix< matrix::dynamic, matrix::dynamic, RealMatrix
 
typedef Vec< matrix::dynamic, Double > Vec_d
 
typedef Vec< matrix::dynamic, RealVec
 

Public Member Functions

 Svd ()
 
template<class T >
 Svd (const MatrixBase< T > &a, Mode mode=Mode::reduced)
 Calculate the SVD of matrix A. More...
 
template<class T >
Svdcalc (const MatrixBase< T > &a, Mode mode=Mode::reduced)
 Calculate the SVD of matrix A. More...
 
template<class T >
SvdcalcValues (const MatrixBase< T > &a)
 Calculate the singular values of matrix A. This is a fast method for when the left and right singular vectors are not needed. More...
 
template<class B , class X >
void solve (const MatrixBase< B > &b, MatrixBase< X > &x)
 Solve the linear system $ Ax = B $ where A is the decomposed matrix. A and B row sizes must match. More...
 
template<class T >
void inverse (MatrixBase< T > &res)
 Calculate the inverse of A, the decomposed matrix. More...
 
const Vecw () const
 Get the singular values of the decomposition. More...
 
const Matrixu () const
 Get the left singular column vectors of the decomposition. More...
 
const Matrixvt () const
 Get the right singular row vectors of the decomposition. More...
 

Detailed Description

template<class Real>
class honey::Svd< Real >

Singular Value Decomposition. Can be used to calculate the pseudo-inverse of any matrix or solve least squares problems.

The full SVD of (m x n) matrix A is: $ A = U W V^T $ where the columns of (m x m) u and rows of (n x n) vt contain the orthogonal left and right singular vectors and (m x n) w contains the diagonal non-negative singular values.

In the reduced SVD, the singular vectors beyond the smallest dimension are not computed.
So, given w_dim = min(m,n), u is (m x w_dim), and vt is (w_dim x n).

Most linear systems do not require the full SVD to solve.

Complexity: $ O(n^2 m) $, where n and m are the smaller and larger of the two dimensions

Member Typedef Documentation

template<class Real >
typedef Matrix<matrix::dynamic, matrix::dynamic, Real> honey::Svd< Real >::Matrix
template<class Real >
typedef Vec<matrix::dynamic, Real> honey::Svd< Real >::Vec
template<class Real >
typedef Vec<matrix::dynamic, Double> honey::Svd< Real >::Vec_d

Member Enumeration Documentation

template<class Real >
enum honey::Svd::Mode
strong
Enumerator
full 

compute full SVD

reduced 

compute reduced SVD

Constructor & Destructor Documentation

template<class Real >
honey::Svd< Real >::Svd ( )
inline
template<class Real >
template<class T >
honey::Svd< Real >::Svd ( const MatrixBase< T > &  a,
Mode  mode = Mode::reduced 
)
inline

Calculate the SVD of matrix A.

Member Function Documentation

template<class Real >
template<class T >
Svd& honey::Svd< Real >::calc ( const MatrixBase< T > &  a,
Mode  mode = Mode::reduced 
)
inline

Calculate the SVD of matrix A.

template<class Real >
template<class T >
Svd& honey::Svd< Real >::calcValues ( const MatrixBase< T > &  a)
inline

Calculate the singular values of matrix A. This is a fast method for when the left and right singular vectors are not needed.

template<class Real >
template<class T >
void honey::Svd< Real >::inverse ( MatrixBase< T > &  res)
inline

Calculate the inverse of A, the decomposed matrix.

template<class Real >
template<class B , class X >
void honey::Svd< Real >::solve ( const MatrixBase< B > &  b,
MatrixBase< X > &  x 
)
inline

Solve the linear system $ Ax = B $ where A is the decomposed matrix. A and B row sizes must match.

template<class Real >
const Matrix& honey::Svd< Real >::u ( ) const
inline

Get the left singular column vectors of the decomposition.

template<class Real >
const Matrix& honey::Svd< Real >::vt ( ) const
inline

Get the right singular row vectors of the decomposition.

template<class Real >
const Vec& honey::Svd< Real >::w ( ) const
inline

Get the singular values of the decomposition.


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