Honeycomb
0.1
Component-Model Framework
|
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, Real > | Matrix |
typedef Vec< matrix::dynamic, Double > | Vec_d |
typedef Vec< matrix::dynamic, Real > | Vec |
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 > | |
Svd & | calc (const MatrixBase< T > &a, Mode mode=Mode::reduced) |
Calculate the SVD of matrix A. More... | |
template<class T > | |
Svd & | calcValues (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 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 Vec & | w () const |
Get the singular values of the decomposition. More... | |
const Matrix & | u () const |
Get the left singular column vectors of the decomposition. More... | |
const Matrix & | vt () const |
Get the right singular row vectors of the decomposition. More... | |
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: 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: , where n and m are the smaller and larger of the two dimensions
typedef Matrix<matrix::dynamic, matrix::dynamic, Real> honey::Svd< Real >::Matrix |
typedef Vec<matrix::dynamic, Real> honey::Svd< Real >::Vec |
typedef Vec<matrix::dynamic, Double> honey::Svd< Real >::Vec_d |
|
strong |
|
inline |
|
inline |
Calculate the SVD of matrix A.
|
inline |
Calculate the SVD of matrix 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.
|
inline |
Calculate the inverse of A, the decomposed matrix.
|
inline |
Solve the linear system where A is the decomposed matrix. A and B row sizes must match.
|
inline |
Get the left singular column vectors of the decomposition.
|
inline |
Get the right singular row vectors of the decomposition.
|
inline |
Get the singular values of the decomposition.