Singular value decomposition. |
||
Syntax |
U, S, V = svd(A) U, S, V = svd(A, 0) U, S, V = svd(A, 'econ') |
|
Argument |
Name |
Description |
A |
A matrix; real or complex. |
|
0 or 'econ' |
The flag for economy-sized decomposition. |
|
Outputs |
Name |
Description |
U |
Unitary square matrix (singular vectors). |
|
S |
Real diagonal matrix (singular values). |
|
V |
Orthogonal matrix (singular vectors). |
|
Example |
Syntax |
|
M = [1,2;3,4;5,6]; u,s,v = SVD(M); print('u = ', u); print('s = ', s); print('v = ', v); A = UnifRnd(0,1,4,2) * UnifRnd(0,1,2,4); U, S, V = svd(A); print('U = ', U); print('S = ', S); print('V = ', V); // economy size decomposition U0, S0, V0 = svd(A, 0); print('economy size decomposition:'); print('U0 = ', U0); print('S0 = ', S0); print('V0 = ', V0); |
||
Comments |
U, S, V = svd(A) computes Singular Value Decomposition of the matrix A. Every matrix has a singular value decomposition. S is a diagonal matrix of the same dimension as A and with non-negative diagonal elements in decreasing order. U and V are unitary matrices so that A = U * S * V`. U, S, V = svd(A, 0) or U, S, V = svd(A, 'econ') computes a compact decomposition of matrix A. This "economy size" decomposition eliminates the unnecessary rows or columns of U or V. SVD decompositions are based on the LAPACK routines dgesvd for real matrices and zgesvd for the complex case. Implemented in HyperMath version 13.0 and later is singular value decomposition based on the BLAS and LAPACK standard libraries.
V = [Matrix] 2 x 2 Hypermath 13.0 |
|
See Also: |