IMSL_SVDCOMP
Syntax | Return Value | Arguments | Keywords | Discussion | Examples | Errors | Version History
The IMSL_SVDCOMP function computes the singular value decomposition (SVD), A = USVT, of a real or complex rectangular matrix A. An estimate of the rank of A also can be computed.
Note
This routine requires an IDL Advanced Math and Stats license. For more information, contact your ITT Visual Information Solutions sales or technical support representative.
Syntax
Result = IMSL_SVDCOMP(a [, /DOUBLE] [, INVERSE=variable] [, RANK=variable] [, TOL_RANK=variable] [, U=variable] [, V=variable])
Return Value
One-dimensional array containing ordered singular values of A.
Arguments
a
Two-dimensional matrix containing the coefficient matrix. Element A (i, j) contains the j-th coefficient of the i-th equation.
Keywords
DOUBLE
If present and nonzero, double precision is used.
INVERSE
Named variable into which the generalized inverse of the matrix A is stored.
RANK
Named variable into which an estimate of the rank of A is stored.
TOL_RANK
Named variable containing the tolerance used to determine when a singular value is negligible and replaced by the value zero. If TOL_RANK > 0, then a singular value si,i is considered negligible if si,i ≤ TOL_RANK. If TOL_RANK < 0, then a singular value si,i is considered negligible if si,i ≤ TOL_RANK * ||A||infinity.
In this case, |TOL_RANK| should be an estimate of relative error or uncertainty in the data.
U
Named variable into which the left-singular vectors of A are stored.
V
Named variable into which the right-singular vectors of A are stored.
Discussion
The IMSL_SVDCOMP function computes the singular value decomposition of a real or complex matrix A. It reduces the matrix A to a bidiagonal matrix B by pre- and post-multiplying Householder transformations, then, it computes singular value decomposition of B using the implicit-shifted QR algorithm. An estimate of the rank of the matrix A is obtained by finding the smallest integer k such that sk,k ≤ TOL_RANK or sk,k ≤ TOL_RANK * ||A||infinity.
Since si + 1, i + 1 ≤ s i,i , it follows that all the s i,i satisfy the same inequality for i = k, ..., min(m, n) – 2. The rank is set to the value k. If A = USVT, its generalized inverse is A+ = VS+UT. Here, S+ = diag (s–10,0,..., s–1i,i, 0, ..., 0). Only singular values that are not negligible are reciprocated. If the keyword INVERSE is specified, the function first computes the singular value decomposition of the matrix A, then computes the generalized inverse. The IMSL_SVDCOMP function fails if the QR algorithm does not converge after 30 iterations.
Examples
Example 1
This example computes the singular values of a 6-by-4 real matrix.
RM, a, 6, 4 ; Define the matrix. row 0: 1 2 1 4 row 1: 3 2 1 3 row 2: 4 3 1 4 row 3: 2 1 3 1 row 4: 1 5 2 2 row 5: 1 2 2 3 ; Call IMSL_SVDCOMP and output the results. singvals = IMSL_SVDCOMP(a) PM, singvals 11.4850 3.26975 2.65336 2.08873
Example 2
This example computes the singular value decomposition of the 6-by-4 real matrix A. Matrices U and V are returned using keywords U and V.
RM, a, 6, 4 ; Define the matrix. row 0: 1 2 1 4 row 1: 3 2 1 3 row 2: 4 3 1 4 row 3: 2 1 3 1 row 4: 1 5 2 2 row 5: 1 2 2 3 ; Call IMSL_SVDCOMP with keywords U and V and output the results. singvals = IMSL_SVDCOMP(a, U = u, V = v) PM, singvals, Title = 'Singular values', Format = '(f12.6)' Singular values 11.485018 3.269752 2.653356 2.088730 PM, u, Title = 'Left singular vectors, U', Format = '(4f12.6)' Left singular vectors, U -0.380476 0.119671 0.439083 -0.565399 -0.403754 0.345111 -0.056576 0.214776 -0.545120 0.429265 0.051392 0.432144 -0.264784 -0.068320 -0.883861 -0.215254 -0.446310 -0.816828 0.141900 0.321270 -0.354629 -0.102147 -0.004318 -0.545800 PM, v, Title = 'Right singular vectors, V', Format = '(4f12.6)' Right singular vectors, V -0.444294 0.555531 -0.435379 0.551754 -0.558067 -0.654299 0.277457 0.428336 -0.324386 -0.351361 -0.732099 -0.485129 -0.621239 0.373931 0.444402 -0.526066
Errors
Warning Errors
MATH_SLOWCONVERGENT_MATRIX—Convergence cannot be reached after 30 iterations.
Version History