These subroutines factor general matrix A using Gaussian
elimination with partial pivoting. To solve the system of equations
with one or more right-hand sides, follow the call to these subroutines with
one or more calls to SGETRS, DGETRS CGETRS, or ZGETRS, respectively. To
compute the inverse of |real matrix A, follow the call to these subroutines with a
call to |SGETRI or DGETRI.
A | Subroutine |
Short-precision real | SGETRF |
Long-precision real | DGETRF |
Short-precision complex | CGETRF |
Long-precision complex | ZGETRF |
Fortran | CALL SGETRF | DGETRF | CGETRF | ZGETRF (m, n, a, lda, ipvt, info) |
C and C++ | sgetrf | dgetrf | cgetrf | zgetrf (m, n, a, lda, ipvt, info); |
PL/I | CALL SGETRF | DGETRF | CGETRF | ZGETRF (m, n, a, lda, ipvt, info); |
If info = 0, the factorization of general matrix A completed successfully.
If info > 0, info is set equal to the first i, where Uii is singular and its inverse could not be computed.
Specified as: a fullword integer; info >= 0.
The matrix A is factored using Gaussian elimination with partial pivoting (ipvt) to compute the LU factorization of A, where (A=PLU):
On output, the transformed matrix A contains U in the upper triangle (if m >= n) or upper trapezoid (if m < n) and L in the strict lower triangle (if m <= n) or lower trapezoid (if m > n). ipvt contains the pivots representing permutation P, such that A = PLU.
If m or n is 0, no computation is performed and the subroutine returns after doing some parameter checking. See references [|8][36] and [62].
Unable to allocate internal work area.
Matrix A is singular.
This example shows a factorization of a real general matrix A of order 9.
M N A LDA IPVT INFO | | | | | | CALL DGETRF( 9 , 9 , A, 9 , IPVT, INFO )
* * | 1.0 1.2 1.4 1.6 1.8 2.0 2.2 2.4 2.6 | | 1.2 1.0 1.2 1.4 1.6 1.8 2.0 2.2 2.4 | | 1.4 1.2 1.0 1.2 1.4 1.6 1.8 2.0 2.2 | | 1.6 1.4 1.2 1.0 1.2 1.4 1.6 1.8 2.0 | A = | 1.8 1.6 1.4 1.2 1.0 1.2 1.4 1.6 1.8 | | 2.0 1.8 1.6 1.4 1.2 1.0 1.2 1.4 1.6 | | 2.2 2.0 1.8 1.6 1.4 1.2 1.0 1.2 1.4 | | 2.4 2.2 2.0 1.8 1.6 1.4 1.2 1.0 1.2 | | 2.6 2.4 2.2 2.0 1.8 1.6 1.4 1.2 1.0 | * *
* * | 2.6 2.4 2.2 2.0 1.8 1.6 1.4 1.2 1.0 | | 0.4 0.3 0.6 0.8 1.1 1.4 1.7 1.9 2.2 | | 0.5 -0.4 0.4 0.8 1.2 1.6 2.0 2.4 2.8 | | 0.5 -0.3 0.0 0.4 0.8 1.2 1.6 2.0 2.4 | A = | 0.6 -0.3 0.0 0.0 0.4 0.8 1.2 1.6 2.0 | | 0.7 -0.2 0.0 0.0 0.0 0.4 0.8 1.2 1.6 | | 0.8 -0.2 0.0 0.0 0.0 0.0 0.4 0.8 1.2 | | 0.8 -0.1 0.0 0.0 0.0 0.0 0.0 0.4 0.8 | | 0.9 -0.1 0.0 0.0 0.0 0.0 0.0 0.0 0.4 | * *
IPVT = (9, 9, 9, 9, 9, 9, 9, 9, 9) INFO = 0
This example shows a factorization of a complex general matrix A of order 9.
M N A LDA IPVT INFO | | | | | | CALL ZGETRF( 9 , 9 , A, 9 , IPVT, INFO )
* *
| (2.0, 1.0) (2.4,-1.0) (2.8,-1.0) (3.2,-1.0) (3.6,-1.0) (4.0,-1.0) (4.4,-1.0) (4.8,-1.0) (5.2,-1.0) |
| (2.4, 1.0) (2.0, 1.0) (2.4,-1.0) (2.8,-1.0) (3.2,-1.0) (3.6,-1.0) (4.0,-1.0) (4.4,-1.0) (4.8,-1.0) |
| (2.8, 1.0) (2.4, 1.0) (2.0, 1.0) (2.4,-1.0) (2.8,-1.0) (3.2,-1.0) (3.6,-1.0) (4.0,-1.0) (4.4,-1.0) |
| (3.2, 1.0) (2.8, 1.0) (2.4, 1.0) (2.0, 1.0) (2.4,-1.0) (2.8,-1.0) (3.2,-1.0) (3.6,-1.0) (4.0,-1.0) |
A = | (3.6, 1.0) (3.2, 1.0) (2.8, 1.0) (2.4, 1.0) (2.0, 1.0) (2.4,-1.0) (2.8,-1.0) (3.2,-1.0) (3.6,-1.0) |
| (4.0, 1.0) (3.6, 1.0) (3.2, 1.0) (2.8, 1.0) (2.4, 1.0) (2.0, 1.0) (2.4,-1.0) (2.8,-1.0) (3.2,-1.0) |
| (4.4, 1.0) (4.0, 1.0) (3.6, 1.0) (3.2, 1.0) (2.8, 1.0) (2.4, 1.0) (2.0, 1.0) (2.4,-1.0) (2.8,-1.0) |
| (4.8, 1.0) (4.4, 1.0) (4.0, 1.0) (3.6, 1.0) (3.2, 1.0) (2.8, 1.0) (2.4, 1.0) (2.0, 1.0) (2.4,-1.0) |
| (5.2, 1.0) (4.8, 1.0) (4.4, 1.0) (4.0, 1.0) (3.6, 1.0) (3.2, 1.0) (2.8, 1.0) (2.4, 1.0) (2.0, 1.0) |
* *
* *
| (5.2, 1.0) (4.8, 1.0) (4.4, 1.0) (4.0, 1.0) (3.6, 1.0) (3.2, 1.0) (2.8, 1.0) (2.4, 1.0) (2.0, 1.0) |
| (0.4, 0.1) (0.6,-2.0) (1.1,-1.9) (1.7,-1.9) (2.3,-1.8) (2.8,-1.8) (3.4,-1.7) (3.9,-1.7) (4.5,-1.6) |
| (0.5, 0.1) (0.0,-0.1) (0.6,-1.9) (1.2,-1.8) (1.8,-1.7) (2.5,-1.6) (3.1,-1.5) (3.7,-1.4) (4.3,-1.3) |
| (0.6, 0.1) (0.0,-0.1) (-0.1,-0.1) (0.7,-1.9) (1.3,-1.7) (2.0,-1.6) (2.7,-1.5) (3.4,-1.4) (4.0,-1.2) |
A = | (0.6, 0.1) (0.0,-0.1) (-0.1,-0.1) (-0.1, 0.0) (0.7,-1.9) (1.5,-1.7) (2.2,-1.6) (2.9,-1.5) (3.7,-1.3) |
| (0.7, 0.1) (0.0,-0.1) (0.0, 0.0) (-0.1, 0.0) (-0.1, 0.0) (0.8,-1.9) (1.6,-1.8) (2.4,-1.6) (3.2,-1.5) |
| (0.8, 0.0) (0.0, 0.0) (0.0, 0.0) (0.0, 0.0) (0.0, 0.0) (0.0, 0.0) (0.8,-1.9) (1.7,-1.8) (2.5,-1.8) |
| (0.9, 0.0) (0.0, 0.0) (0.0, 0.0) (0.0, 0.0) (0.0, 0.0) (0.0, 0.0) (0.0, 0.0) (0.8,-2.0) (1.7,-1.9) |
| (0.9, 0.0) (0.0, 0.0) (0.0, 0.0) (0.0, 0.0) (0.0, 0.0) (0.0, 0.0) (0.0, 0.0) (0.0, 0.0) (0.8,-2.0) |
* *
IPVT = (9, 9, 9, 9, 9, 9, 9, 9, 9) INFO = 0
|This example shows a factorization of a real general matrix A of |order 9.
| M N A LDA IPVT INFO | | | | | | | |CALL SGETRF( 9 , 9 , A, 9 , IPVT, INFO )
| * * | | 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 | | * *
|
| * * | | 4.0000 1.0000 1.0000 1.0000 1.0000 1.0000 0.0000 0.0000 0.0000 | | | 0.0000 5.0000 1.0000 1.0000 1.0000 1.0000 1.0000 0.0000 0.0000 | | | 0.0000 0.0000 6.0000 1.0000 1.0000 1.0000 1.0000 1.0000 0.0000 | | | 0.0000 0.0000 0.0000 7.0000 1.0000 1.0000 1.0000 1.0000 1.0000 | |A = | 0.0000 0.0000 0.0000 0.0000 8.0000 1.0000 1.0000 1.0000 1.0000 | | | 0.0000 0.0000 0.0000 0.0000 0.0000 9.0000 1.0000 1.0000 1.0000 | | | 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 10.0000 11.0000 12.0000 | | | 0.2500 0.1500 0.1000 0.0714 0.0536 -0.0694 -0.0306 0.1806 0.3111 | | | 0.2500 0.1500 0.1000 0.0714 -0.0714 -0.0556 -0.0194 0.9385 -0.0031 | | * *
|IPVT = (3, 4, 5, 6, 7, 8, 9, 8, 9)