#include <matrix/matrixMat.h>
Public Methods | |
SVDMatrix () | |
SVDMatrix (const Matrix< T > &A) | |
int | decompose (const Matrix< T > &A) |
void | minMax (T &min_sig, T &max_sig) const |
double | q_cond_number (void) const |
void | cut_off (const double min_sig) |
void | inverseIn (Matrix< T > &inv, double tau=0) |
Matrix< T > | inverse (double tau=0) |
int | solve (const Matrix< T > &B, Matrix< T > &X, double tau=0) |
Public Attributes | |
const Matrix< T > & | U |
const Matrix< T > & | V |
const Vector< T > & | sig |
Protected Methods | |
double | left_householder (Matrix< T > &A, const int i) |
double | right_householder (Matrix< T > &A, const int i) |
double | bidiagonalize (Vector< T > &super_diag, const Matrix< T > &_A) |
void | rotate (Matrix< T > &U, const int i, const int j, const double cos_ph, const double sin_ph) |
void | rip_through (Vector< T > &super_diag, const int k, const int l, const double eps) |
int | get_submatrix_to_work_on (Vector< T > &super_diag, const int k, const double eps) |
void | diagonalize (Vector< T > &super_diag, const double eps) |
Protected Attributes | |
int | M |
int | N |
Matrix< T > | U_ |
Matrix< T > | V_ |
Vector< T > | sig_ |
This matrix was adapted from the Numerical Math Class Library developed by Oleg Kiselyov.
This class can only be used with floating point values (float or double).
The following comments are from Oleg Kiselyov.
Singular Value Decomposition of a rectangular matrix
A=U Sig V'
where matrices U and V are orthogonal and Sig is a
diagonal matrix.
The singular value decomposition is performed by constructing an SVD object from an M*N matrix A with M \ge N (that is, at least as many rows as columns). Note, in case M > N, matrix Sig has to be a M*N diagonal matrix. However, it has only N diagonal elements, which we store in a vector sig.
Algorithm: Bidiagonalization with Householder reflections followed by a modification of a QR-algorithm. For more details, see G.E. Forsythe, M.A. Malcolm, C.B. Moler Computer methods for mathematical computations, Prentice-Hall, 1977. However, in the present implementation, matrices U and V are computed right away rather than delayed until after all Householder reflections.
This code is based for the most part on a Algol68 code I (Oleg Kiselyov) wrote ca. 1987.
Look at the source code for more information about the algorithm.
Definition at line 179 of file matrixMat.h.
|
Performs the SVD decomposition of A.
Performs the SVD decomposition of A. It is not recommended to use this routine has errors from the decomposition routine are discarded
Definition at line 796 of file matrixMat.cpp. References decompose. |
|
Performs the SVD decomposition of A.
Performs the SVD decomposition of A.
Definition at line 817 of file matrixMat.cpp. References N, sig_, U_, and V_. Referenced by SVDMatrix. |
|
Finds the (pseudo-)inverse of a SVD matrix.
Finds the (pseudo-)inverse of a SVD matrix.
Definition at line 951 of file matrixMat.cpp. References inverseIn. |
|
Finds the (pseudo-)inverse of a SVD matrix.
Finds the (pseudo-)inverse of a SVD matrix.
Definition at line 907 of file matrixMat.cpp. References minMax. Referenced by inverse. |
|
Finds the minimal and maximal sigma values.
Finds the minimal and maximal sigma values.
Definition at line 862 of file matrixMat.cpp. Referenced by inverseIn, q_cond_number, and solve. |
|
Finds the condition number.
Finds the condition number which corresponds to the maximal sigma value divided by its minimal value.
Definition at line 886 of file matrixMat.cpp. References minMax. |
|
Solves the linear system A X = B.
Solves the linear system A X = B. Given A and B it finds the value of X. A is the SVD matrix properly initialized and the only other input parameter is B.
Definition at line 977 of file matrixMat.cpp. References minMax. |