|These subroutines find the inverse of general matrix |A.
|Subroutines SGEICD and DGEICD also find the reciprocal of the condition number and the
determinant of |general matrix A.
A, aux, rcond, det, work | Subroutine |
Short-precision real | SGEICD and SGETRI |
Long-precision real | DGEICD and DGETRI |
|The input to SGETRI and DGETRI must be the output from the |factorization subroutines SGETRF and DGETRF, respectively.
Fortran | CALL SGEICD | DGEICD (a, lda, n,
iopt, rcond, det, aux, naux)
CALL SGETRI | DGETRI (n, a, lda, ipvt, work, lwork, info) |
C and C++ | sgeicd | dgeicd (a, lda, n, iopt,
rcond, det, aux, naux);
sgetri | dgetri (n, a, lda, ipvt, work, lwork, info); |
PL/I | CALL SGEICD | DGEICD (a, lda, n,
iopt, rcond, det, aux,
naux);
CALL SGETRI | DGETRI (n, a, lda, ipvt, work, lwork, info); |
If iopt = 0, 1, 2, or 3, it is matrix A of order n, whose inverse, reciprocal of condition number, and determinant are computed.
If iopt = 4, it is the transformed matrix A of order n, resulting from the factorization performed in a previous call to SGEF/SGEFCD or DGEF/DGEFCD/DGEFP, respectively, whose inverse is computed. |
|It is the transformed matrix A of order n, resulting |from the factorization performed in a previous call to SGETRF or DGETRF, |respectively, whose inverse is computed.
Specified as: an lda by (at least) n array, containing numbers of the data type indicated in Table 100.
If iopt = 0, the inverse is computed for matrix A.
If iopt = 1, the inverse and the reciprocal of the condition number are computed for matrix A.
If iopt = 2, the inverse and the determinant are computed for matrix A.
If iopt = 3, the inverse, the reciprocal of the condition number, and the determinant are computed for matrix A.
If iopt = 4, the inverse is computed using the factored matrix A.
Specified as: a fullword integer; iopt = 0, 1, 2, 3, 4.
If iopt = 0, 1, 2, or 3, then if naux = 0 and error 2015 is unrecoverable, aux is ignored. Otherwise, it is the storage work area used by this subroutine.
If iopt = 4, aux has the following meaning:
Specified as: an area of storage, containing numbers of the data type indicated in Table 100.
If iopt <> 4, then if naux = 0 and error 2015 is unrecoverable, SGEICD and DGEICD dynamically allocate the work area used by the subroutine. The work area is deallocated before control is returned to the calling program.
Otherwise naux must have the following value:
For the |POWER, POWER3, |POWER4, or PowerPC processors, naux >= 100n.
For the |POWER2 processors, naux >= 200n.
|If lwork = 0, work is ignored.
|If lwork <> 0, work is the work area used by |this subroutine, where: |
|Specified as: an area of storage containing numbers of data type |indicated in Table 100.
|Specified as: a fullword integer; where: |
|lwork >= max(1, n)
where 1 <= det1 < 10. Returned as: an array of length 2, containing numbers of the data type indicated in Table 100.
|If lwork <> 0 and lwork <> -1, |its size is (at least) of length lwork.
|If lwork = -1, its size is (at least) of length |1.
|Returned as: an area of storage, where:
|If lwork >= 1 or lwork = -1, then |work1 is set to the optimal lwork value and |contains numbers of the data type indicated in Table 100. Except for work1, the contents |of work are overwritten on return.
|If info = 0, the inverse completed successfully.
|If info > 0, info is set equal to the |first i, where Uii is exactly zero. The |matrix is singular, and its inverse could not be computed.
|Specified as: a fullword integer; |info >= 0.
|The input scalar arguments for SGETRI and DGETRI must be set to the same |values as the corresponding input arguments in the previous call to SGETRF or |DGETRF, respectively.
|For subroutines SGEICD and DGEICD, the inverse, the reciprocal of the condition number, and the determinant of a general square matrix A are computed using partial pivoting to preserve accuracy, where:
The iopt argument is used to determine the combination of output items produced by this subroutine: the inverse, the reciprocal of the condition number, and the determinant.
|For subroutines SGETRI and DGETRI, the inverse of general square |matrix A is computed.
If n is 0, no computation is performed. See references [36], [38], and [44].
If iopt = 0, 1, 2, or 3, then error 2015 is unrecoverable, naux = 0, and unable to allocate work area.
This example computes the inverse, the reciprocal of the condition number, and the determinant of matrix A. The values used to compute the reciprocal of the condition number in this example are obtained with the following values:
On output, the value in det, |A|, is equal to 336.
A LDA N IOPT RCOND DET AUX NAUX | | | | | | | | CALL DGEICD( A , 9 , 9 , 3 , RCOND , DET , AUX , 293 ) * * | 1.0 1.0 1.0 1.0 0.0 0.0 0.0 0.0 0.0 | | 1.0 1.0 1.0 1.0 1.0 0.0 0.0 0.0 0.0 | | 4.0 1.0 1.0 1.0 1.0 1.0 0.0 0.0 0.0 | | 0.0 5.0 1.0 1.0 1.0 1.0 1.0 0.0 0.0 | A = | 0.0 0.0 6.0 1.0 1.0 1.0 1.0 1.0 0.0 | | 0.0 0.0 0.0 7.0 1.0 1.0 1.0 1.0 1.0 | | 0.0 0.0 0.0 0.0 8.0 1.0 1.0 1.0 1.0 | | 0.0 0.0 0.0 0.0 0.0 9.0 1.0 1.0 1.0 | | 0.0 0.0 0.0 0.0 0.0 0.0 10.0 11.0 12.0 | * *
* * | 0.333 -0.667 0.333 0.000 0.000 0.000 0.042 -0.042 0.000 | | 56.833 -52.167 -1.167 -0.500 -0.500 -0.357 6.836 -0.479 -0.500 | | -55.167 51.833 0.833 0.500 0.500 0.214 -6.735 0.521 0.500 | | -1.000 1.000 0.000 0.000 0.000 0.143 -0.143 0.000 0.000 | A = | -1.000 1.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 | | -1.000 1.000 0.000 0.000 0.000 0.000 -0.125 0.125 0.000 | | -226.000 206.000 5.000 3.000 2.000 1.429 -27.179 1.750 2.000 | | 560.000 -520.000 -10.000 -6.000 -4.000 -2.857 67.857 -5.000 -5.000 | | -325.000 305.000 5.000 3.000 2.000 1.429 -39.554 3.125 3.000 | * * RCOND = 0.00005436 DET = (3.36, 2.00)
|This example computes the inverse of matrix A, |where: iopt = 4; matrix A is the |transformed matrix factored by SGEF in Example 1; and the input contents of AUX are the same |as the output contents of IPVT in Example 1.
A LDA N IOPT RCOND DET AUX NAUX | | | | | | | | CALL SGEICD( A , 9 , 9 , 4 , RCOND , DET , AUX , 300 )
* * | 0.333 -0.667 0.333 0.000 0.000 0.000 0.042 -0.042 0.000 | | 56.833 -52.167 -1.167 -0.500 -0.500 -0.357 6.836 -0.479 -0.500 | | -55.167 51.833 0.833 0.500 0.500 0.214 -6.735 0.521 0.500 | | -1.000 1.000 0.000 0.000 0.000 0.143 -0.143 0.000 0.000 | A = | -1.000 1.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 | | -1.000 1.000 0.000 0.000 0.000 0.000 -0.125 0.125 0.000 | | -226.000 206.000 5.000 3.000 2.000 1.429 -27.179 1.750 2.000 | | 560.000 -520.000 -10.000 -6.000 -4.000 -2.857 67.857 -5.000 -5.000 | | -325.000 305.000 5.000 3.000 2.000 1.429 -39.554 3.125 3.000 | * *
|This example computes the inverse of matrix A, where matrix |A is the transformed matrix factored by SGETRF in Example 3 and the input contents of IPVT are the same |as the output contents of IPVT in Example 3.
| N A LDA IPVT WORK LWORK INFO | | | | | | | | |CALL SGETRI( 9 , A , 9 , IPVT , WORK , 0 , INFO ) |
|Output:
| * * | | 0.333 -0.667 0.333 0.000 0.000 0.000 0.042 -0.042 0.000 | | | 56.833 -52.167 -1.167 -0.500 -0.500 -0.357 6.836 -0.479 -0.500 | | | -55.167 51.833 0.833 0.500 0.500 0.214 -6.735 0.521 0.500 | | | -1.000 1.000 0.000 0.000 0.000 0.143 -0.143 0.000 0.000 | |A = | -1.000 1.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 | | | -1.000 1.000 0.000 0.000 0.000 0.000 -0.125 0.125 0.000 | | | -226.000 206.000 5.000 3.000 2.000 1.429 -27.179 1.750 2.000 | | | 560.000 -520.000 -10.000 -6.000 -4.000 -2.857 67.857 -5.000 -5.000 | | | -325.000 305.000 5.000 3.000 2.000 1.429 -39.554 3.125 3.000 | | * *
|INFO = 0