These subroutines compute the singular value decomposition of general
matrix A in preparation for solving linear least squares
problems. To compute the minimal norm linear least squares solution of
AX is congruent to B, follow the call to these
subroutines with a call to SGESVS or DGESVS, respectively.
A, B, s, aux | Subroutine |
Short-precision real | SGESVF |
Long-precision real | DGESVF |
Fortran | CALL SGESVF | DGESVF (iopt, a, lda, b, ldb, nb, s, m, n, aux, naux) |
C and C++ | sgesvf | dgesvf (iopt, a, lda, b, ldb, nb, s, m, n, aux, naux); |
PL/I | CALL SGESVF | DGESVF (iopt, a, lda, b, ldb, nb, s, m, n, aux, naux); |
If iopt = 0 or 10, singular values are computed.
If iopt = 1 or 11, singular values and V are computed.
If iopt = 2 or 12, singular values, V, and UTB are computed.
Specified as: a fullword integer; iopt = 0, 1, 2, 10, 11, or 12.
If iopt < 10, singular values are unordered.
If iopt >= 10, singular values are sorted in descending order and, if applicable, the columns of V and the rows of UTB are swapped to correspond to the sorted singular values.
If iopt = 0, 1, 10, or 11, this argument is not used in the computation.
If iopt = 2 or 12, it is the m by nb matrix B.
Specified as: an ldb by (at least) nb array, containing numbers of the data type indicated in Table 117.
If this subroutine is followed by a call to SGESVS or DGESVS, B should contain the right-hand side of the linear least squares problem, AX is congruent to B. (The nb column vectors of B contain right-hand sides for nb distinct linear least squares problems.) However, if the matrix UT is desired on output, B should be equal to the identity matrix of order m.
If iopt = 0, 1, 10, or 11, this argument is not used in the computation.
If iopt = 2 or 12, it is the leading dimension of the array specified for b.
Specified as: a fullword integer. It must have the following values, where:
If iopt = 0, 1, 10, or 11, ldb > 0.
If iopt = 2 or 12, ldb > 0 and ldb >= max(m, n).
If iopt = 0, 1, 10, or 11, this argument is not used in the computation.
If iopt = 2 or 12, it is the number of columns in matrix B.
Specified as: a fullword integer; if iopt = 2 or 12, nb > 0.
If naux = 0 and error 2015 is unrecoverable, aux is ignored.
Otherwise, it is the storage work area used by this subroutine. Its size is specified by naux.
Specified as: an area of storage, containing numbers of the data type indicated in Table 117.
If naux = 0 and error 2015 is unrecoverable, SGESVF and DGESVF dynamically allocate the work area used by the subroutine. The work area is deallocated before control is returned to the calling program.
Otherwise, It must have the following value, where:
If iopt = 0 or 10, naux >= n+max(m, n).
If iopt = 1 or 11, naux >= 2n+max(m, n).
If iopt = 2 or 12, naux >= 2n+max(m, n, nb).
If iopt = 0, or 10, A is overwritten; that is, the original input is not preserved.
If iopt = 1, 2, 11, or 12, A contains the real orthogonal matrix V, of order n, in its first n rows and n columns. If iopt = 11 or 12, the columns of V are swapped to correspond to the sorted singular values. If m > n, rows n+1, n+2, ..., m of array A are overwritten; that is, the original input is not preserved.
Returned as: an lda by (at least) n array, containing numbers of the data type indicated in Table 117.
If iopt = 0, 1, 10, or 11, B is not used in the computation.
If iopt = 2 or 12, B is overwritten by the n by nb matrix UTB.
If iopt = 12, the rows of UTB are swapped to correspond to the sorted singular values. If m > n, rows n+1, n+2, ..., m of array B are overwritten; that is, the original input is not preserved.
Returned as: an ldb by (at least) nb array, containing numbers of the data type indicated in Table 117.
If iopt < 10, the singular values are unordered in s.
If iopt >= 10, the singular values are sorted in descending order in s; that is, s1 >= s2 >= ... >= sn >= 0. If applicable, the columns of V and the rows of UTB are swapped to correspond to the sorted singular values.
See Example.
The singular value decomposition of a real general matrix is computed as follows:
where:
If m or n is equal to 0, no computation is performed.
One of the following algorithms is used:
If R = XWYT is the singular value decomposition of R, the singular value decomposition of matrix A is given by:
where:
Also, see references [13], [58], [78], and pages 134 to 151 in reference [99]. These algorithms have a tendency to generate underflows that may hurt overall performance. The system default is to mask underflow, which improves the performance of these subroutines.
Error 2015 is unrecoverable, naux = 0, and unable to allocate work area.
Singular value (i) failed to converge after (x) iterations.
This example shows how to find only the singular values, s, of a real long-precision general matrix A, where:
IOPT A LDA B LDB NB S M N AUX NAUX | | | | | | | | | | | CALL DGESVF( 0 , A , 4 , DUMMY , 1 , 0 , S , 4 , 3 , AUX , 7 ) * * | 1.0 2.0 3.0 | A = | 4.0 5.0 6.0 | | 7.0 8.0 9.0 | | 10.0 11.0 12.0 | * *
S = (25.462, 1.291, 0.000)
This example computes the singular values, s, of a real long-precision general matrix A and the matrix V, where:
IOPT A LDA B LDB NB S M N AUX NAUX | | | | | | | | | | | CALL DGESVF( 1 , A , 3 , DUMMY , 1 , 0 , S , 3 , 3 , AUX , 9 ) * * | 2.0 1.0 1.0 | A = | 4.0 1.0 0.0 | | -2.0 2.0 1.0 | * *
* * | -0.994 0.105 -0.041 | A = | -0.112 -0.870 0.480 | | -0.015 -0.482 -0.876 | * * S = (4.922, 2.724, 0.597)
This example computes the singular values, s, and computes matrices V and UTB in preparation for solving the underdetermined system AX is congruent to B, where:
IOPT A LDA B LDB NB S M N AUX NAUX | | | | | | | | | | | CALL DGESVF( 2 , A , 3 , B , 3 , 1 , S , 2 , 3 , AUX , 9 )
* * | 1.0 2.0 2.0 | A = | 2.0 4.0 5.0 | | . . . | * *
* * | 1.0 | B = | 4.0 | | . | * *
* * | -0.304 -0.894 0.328 | A = | -0.608 0.447 0.656 | | -0.733 0.000 -0.680 | * * * * | -4.061 | B = | 0.000 | | -0.714 | * * S = (7.342, 0.000, 0.305)
This example computes the singular values, s, and matrices V and UTB in preparation for solving the overdetermined system AX is congruent to B, where:
IOPT A LDA B LDB NB S M N AUX NAUX | | | | | | | | | | | CALL DGESVF( 2 , A , 3 , B , 3 , 2 , S , 3 , 2 , AUX , 7 )
* * | 1.0 4.0 | A = | 2.0 5.0 | | 3.0 6.0 | * *
* * | 7.0 10.0 | B = | 8.0 11.0 | | 9.0 12.0 | * *
* * | 0.922 -0.386 | A = | -0.386 -0.922 | | . . | * *
* * | -1.310 -2.321 | B = | -13.867 -18.963 | | . . | * * X = (0.773, 9.508)
This example computes the singular values, s, and matrices V and UTB in preparation for solving the overdetermined system AX is congruent to B. The singular values are sorted in descending order, and the columns of V and the rows of UTB are swapped to correspond to the sorted singular values.
IOPT A LDA B LDB NB S M N AUX NAUX | | | | | | | | | | | CALL DGESVF( 12 , A , 3 , B , 3 , 2 , S , 3 , 2 , AUX , 7 )
* * | 1.0 4.0 | A = | 2.0 5.0 | | 3.0 6.0 | * *
* * | 7.0 10.0 | B = | 8.0 11.0 | | 9.0 12.0 | * *
* * | -0.386 0.922 | A = | -0.922 -0.386 | | . . | * *
* * | -13.867 -18.963 | B = | -1.310 -2.321 | | . . | * * S = (9.508, 0.773)