template<class T>
class gnsstk::SVD< T >
Class SVD: A function object for the singular value decomposition of a matrix. Given a matrix A [m,n], the SVD of A = U*S*transpose(V), where U is [m,m], V is [n,n], and S is [m,n] (like A). Both U and V are unitary [meaning transpose(U)*U = unity = transpose(V)*V] and the columns of U[resp,V] are orthonormal vectors spanning the space A*transpose(A) [transpose(A)*A]. Note that U*transpose(U)=1 and V*transpose(V)=1 are not true in general, but may be. S[m,n] is 'diagonal' in the sense that only diagonal elements are non-zero (even when m != n); the min(m,n) diagonal elements are called the singular values of A, often referred to as S[i]. The singular values may be sorted, as the SVD is invariant under a consistent re-ordering of {singular values / columns of U / columns of V}.
The condition number of A is the ratio cn = fabs(largest S[i])/fabs(smallest S[i]).
Note that inverse(A) = V*inverse(S)*UT where inverse(S) is diagonal with elements equal to the inverse of elements of S, and with dimension [n,m]. The matrix A is non-singular matrix if and only if all of its singular values are non-zero. If some of the singular values are zero, the 'generalized inverse' of A may be formed by editing the singular values in this way: if the ratio of S[i] to S[0] (where S[0] is the largest singular value) is bigger than some tolerance (1.e-7 is good), then 1/S[i] is set to zero in the inverse. In this way the 'generalized inverse' of ANY matrix is guaranteed to exist.
The SVD algorithm never fails.
Ref: Bulirsch and Stoer, "Introduction to Numerical Analysis," NY, Springer-Verlag, 1980.
Matrix<double> m(and is assigned some value);
SVD<double> d;
d(m);
cout << d.U << endl << d.V << endl << d.S << endl;
Definition at line 99 of file MatrixFunctors.hpp.