These subroutines compute the minimal norm linear least squares solution of
AX is congruent to B, using a QR decomposition with
column pivoting.
A, B, X, rn, tau, aux | Subroutine |
Short-precision real | SGELLS |
Long-precision real | DGELLS |
Fortran | CALL SGELLS | DGELLS (iopt, a, lda, b, ldb, x, ldx, rn, tau, m, n, nb, k, aux, naux) |
C and C++ | sgells | dgells (iopt, a, lda, b, ldb, x, ldx, rn, tau, m, n, nb, k, aux, naux); |
PL/I | CALL SGELLS | DGELLS (iopt, a, lda, b, ldb, x, ldx, rn, tau, m, n, nb, k, aux, naux); |
If iopt = 0, X is computed.
If iopt = 1, X and the Euclidean Norm of the residual vectors are computed.
Specified as: a fullword integer; iopt = 0 or 1.
Specified as: an ldb by (at least) nb array, containing numbers of the data type indicated in Table 121.
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 121. On output, the contents of aux are overwritten.
If naux = 0 and error 2015 is unrecoverable, SGELLS and DGELLS 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 values:
naux >= 3n+max(n, nb) for SGELLS
naux >= [ceiling(2.5n)+max(n, nb)] for DGELLS
If k <> 0, the nb column vectors of X contain minimal norm least squares solutions for nb distinct linear least squares problems. The elements in each solution vector correspond to the original columns of A.
If k = 0, the nb column vectors of X are set to 0.
Returned as: an ldx by (at least) nb array, containing numbers of the data type indicated in Table 121.
If iopt = 0 or k = 0, rn is not used in the computation.
If iopt = 1, rni is the Euclidean Norm of the residual vector for the linear least squares problem defined by the i-th column vector of B.
Returned as: a one-dimensional array of (at least) nb, containing numbers of the data type indicated in Table 121.
See references [44], [62], and [78] for additional guidance on determining suitable values for tau.
The minimal norm linear least squares solution of AX is congruent to B is computed using a QR decomposition with column pivoting, where:
Optionally, the Euclidean Norms of the residual vectors can be computed. Following are the steps involved in finding the minimal norm linear least squares solution of AX is congruent to B. A is decomposed, using Householder transformations and column pivoting, into the following form:
where:
k is the first index, where:
If k = n, the minimal norm linear least squares solution is obtained by solving RX = QTB and reordering X to correspond to the original columns of A.
If k < n, R has the following form:
To find the minimal norm linear least squares solution, it is necessary to zero the submatrix R12 using Householder transformations. See references [44], [62], and [78]. If m or n is equal to 0, no computation is performed. 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.
None
This example solves the underdetermined system AX is congruent to B. On output, A and B are overwritten. DUMMY is used as a placeholder for argument rn, which is not used in the computation.
IOPT A LDA B LDB X LDX RN TAU M N NB K AUX NAUX
| | | | | | | | | | | | | | |
CALL DGELLS( 0 , A , 2 , B , 2 , X , 3 , DUMMY , TAU , 2 , 3 , 1 , K , AUX , 11 )
* *
A = | 1.0 2.0 2.0 |
| 2.0 4.0 5.0 |
* *
* *
B = | 1.0 |
| 4.0 |
* *
TAU = 0.0
* * | -0.600 | X = | -1.200 | | 2.000 | * * K = 2
This example solves the overdetermined system AX is congruent to B. On output, A and B are overwritten. DUMMY is used as a placeholder for argument rn, which is not used in the computation.
IOPT A LDA B LDB X LDX RN TAU M N NB K AUX NAUX
| | | | | | | | | | | | | | |
CALL DGELLS( 0 , A , 3 , B , 3 , X , 2 , DUMMY , TAU , 3 , 2 , 2 , K , 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 |
* *
TAU = 0.0
* * X = | -1.000 -2.000 | | 2.000 3.000 | * * K = 2
This example solves the overdetermined system AX is congruent to B and computes the Euclidean Norms of the residual vectors. On output, A and B are overwritten.
IOPT A LDA B LDB X LDX RN TAU M N NB K AUX NAUX
| | | | | | | | | | | | | | |
CALL DGELLS( 1 , A , 3 , B , 3 , X , 2 , RN , TAU , 3 , 2 , 2 , K , AUX , 7 )
* *
| 1.1 -4.3 |
A = | 2.0 -5.0 |
| 3.0 -6.0 |
* *
* *
| -7.0 10.0 |
B = | -8.0 11.0 |
| -9.0 12.0 |
* *
TAU = 0.0
* * X = | 0.543 -1.360 | | 1.785 -2.699 | * *
* * RN = | 0.196 | | 0.275 | * * K = 2