This subroutine factors a square 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 SGES/SGESM, DGES/DGESM, CGES/CGESM, or ZGES/ZGESM,
respectively. To compute the inverse of matrix A, follow the
call to these subroutines with a call to SGEICD or DGEICD,
respectively.
A | Subroutine |
Short-precision real | SGEF |
Long-precision real | DGEF |
Short-precision complex | CGEF |
Long-precision complex | ZGEF |
Fortran | CALL SGEF | DGEF | CGEF | ZGEF (a, lda, n, ipvt) |
C and C++ | sgef | dgef | cgef | zgef (a, lda, n, ipvt); |
PL/I | CALL SGEF | DGEF | CGEF | ZGEF (a, lda, n, ipvt); |
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 and L in the strict lower triangle where ipvt contains the pivots representing permutation P, such that A = PLU.
If n is 0, no computation is performed. See references [36] and [38].
Unable to allocate internal work area.
Matrix A is singular.
This example shows a factorization of a real general matrix A of order 9.
A LDA N IPVT | | | | CALL SGEF( A , 9 , 9 , IPVT )
* * | 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)
This example shows a factorization of a complex general matrix A of order 4.
A LDA N IPVT | | | | CALL CGEF( A , 4 , 4 , IPVT ) * * | (1.0, 2.0) (1.0, 7.0) (2.0, 4.0) (3.0, 1.0) | A = | (2.0, 0.0) (1.0, 3.0) (4.0, 4.0) (2.0, 3.0) | | (2.0, 1.0) (5.0, 0.0) (3.0, 6.0) (0.0, 0.0) | | (8.0, 5.0) (1.0, 9.0) (6.0, 6.0) (8.0, 1.0) | * *
* * | (8.0000, 5.0000) (1.0000, 9.0000) (6.0000, 6.0000) (8.0000, 1.0000) | A = | (0.2022, 0.1236) (1.9101, 5.0562) (1.5281, 2.0449) (1.5056, -0.1910) | | (0.2360, -0.0225) (-0.0654, -0.9269) (-0.3462, 6.2692) (-1.6346, 1.3269) | | (0.1798, -0.1124) (0.2462, 0.1308) (0.4412, -0.3655) (0.2900, 2.3864) | * *
IPVT = (4, 4, 3, 4)