These subroutines factor general matrix A using Gaussian elimination with partial pivoting, ipvt, to compute the LU factorization of A, where, in this description:
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.
To solve the system of equations with any number of right-hand sides, follow the call to these subroutines with one or more calls to PDGETRS or PZGETRS, respectively.
If m = 0 or n = 0, no computation is
performed and the subroutine returns after doing some parameter
checking. See references [16], [18], [22],
[36], and [37].
A | ipvt | Subroutine |
Long-precision real | Integer | PDGETRF |
Long-precision complex | Integer | PZGETRF |
Fortran | CALL PDGETRF | PZGETRF (m, n, a, ia, ja, desc_a, ipvt, info) |
C and C++ | pdgetrf | pzgetrf (m, n, a, ia, ja, desc_a, ipvt, info); |
Scope: global
Specified as: a fullword integer; m >= 0.
Scope: global
Specified as: a fullword integer; n >= 0.
Scope: local
Specified as: an LLD_A by (at least) LOCq(N_A) array, containing numbers of the data type indicated in Table 59. Details about the square block-cyclic data distribution of global matrix A are stored in desc_a.
Scope: global
Specified as: a fullword integer; 1 <= ia <= M_A and ia+m-1 <= M_A.
Scope: global
Specified as: a fullword integer; 1 <= ja <= N_A and ja+n-1 <= N_A.
desc_a | Name | Description | Limits | Scope |
---|---|---|---|---|
1 | DTYPE_A | Descriptor type | DTYPE_A=1 | Global |
2 | CTXT_A | BLACS context | Valid value, as returned by BLACS_GRIDINIT or BLACS_GRIDMAP | Global |
3 | M_A | Number of rows in the global matrix |
If m = 0 or n = 0: M_A >= 0 Otherwise: M_A >= 1 | Global |
4 | N_A | Number of columns in the global matrix |
If m = 0 or n = 0: N_A >= 0 Otherwise: N_A >= 1 | Global |
5 | MB_A | Row block size | MB_A >= 1 | Global |
6 | NB_A | Column block size | NB_A >= 1 | Global |
7 | RSRC_A | The process row of the p × q grid over which the first row of the global matrix is distributed | 0 <= RSRC_A < p | Global |
8 | CSRC_A | The process column of the p × q grid over which the first column of the global matrix is distributed | 0 <= CSRC_A < q | Global |
9 | LLD_A | The leading dimension of the local array | LLD_A >= max(1,LOCp(M_A)) | Local |
Specified as: an array of (at least) length 9, containing fullword integers.
Scope: local
Returned as: an LLD_A by (at least) LOCq(N_A) array, containing numbers of the data type indicated in Table 59.
A copy of the vector ipvt, with a block size of MB_A and global index ia, is returned to each column of the process grid. The process row over which the first row of ipvt is distributed is RSRC_A.
Scope: local
Returned as: an array of (at least) length LOCp(ia+m-1), containing fullword integers, where ia <= (pivoting indices) <= ia+m-1. Details about the block-cyclic data distribution of global vector ipvt are stored in desc_a.
If info = 0, global submatrix A is not singular, and the factorization completed normally.
If info > 0, global submatrix A is singular; that is, one or more columns of L and the corresponding diagonal of U contain all zeros. All columns of L are checked. info is set equal to i, the first column of L with a corresponding zero diagonal element, encountered at Aia+i-1, ja+i-1. The factorization is completed; however, if you call PDGETRS/PZGETRS or PDGETRI/PZGETRI with these factors, results are unpredictable.
Scope: global
Returned as: a fullword integer; info >= 0.
If, however, you do not plan to call PDGETRS/PZGETRS after calling PDGETRF/PZGETRF, then input arguments m and n in PDGETRF/PZGETRF do not need to be equal.
Matrix A is a singular matrix. For details, see the description of the info argument.
Unable to allocate work space
If m <> 0 and n <> 0:
In all cases:
Each of the following global input arguments are checked to determine whether its value differs from the value specified on process P00:
This example factors a 9 × 9 real general matrix using a 2 × 2 process grid. By specifying RSRC_A = 1, the rows of global matrix A and the elements of global vector ipvt are distributed over the process grid starting in the second row of the process grid.
ORDER = 'R' NPROW = 2 NPCOL = 2 CALL BLACS_GET (0, 0, ICONTXT) CALL BLACS_GRIDINIT(ICONTXT, ORDER, NPROW, NPCOL) CALL BLACS_GRIDINFO(ICONTXT, NPROW, NPCOL, MYROW, MYCOL) M N A IA JA DESC_A IPVT INFO | | | | | | | | CALL PDGETRF( 9 , 9 , A , 1 , 1 , DESC_A , IPVT , INFO )
| Desc_A |
---|---|
DTYPE_ | 1 |
CTXT_ | icontxt(IOBG44) |
M_ | 9 |
N_ | 9 |
MB_ | 3 |
NB_ | 3 |
RSRC_ | 1 |
CSRC_ | 0 |
LLD_ | See below(EPSSL44) |
Notes: |
Global general 9 × 9 matrix A with block size 3 × 3:
B,D 0 1 2 * * | 1.0 1.2 1.4 | 1.6 1.8 2.0 | 2.2 2.4 2.6 | 0 | 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 | 1 | 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 | 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 | * *
The following is the 2 × 2 process grid:
B,D | 0 2 | 1 -----| ------- |----- 1 | P00 | P01 -----| ------- |----- 0 | P10 | P11 2 | |
Local arrays for A:
p,q | 0 | 1 -----|--------------------------------|----------------- | 1.6 1.4 1.2 1.6 1.8 2.0 | 1.0 1.2 1.4 0 | 1.8 1.6 1.4 1.4 1.6 1.8 | 1.2 1.0 1.2 | 2.0 1.8 1.6 1.2 1.4 1.6 | 1.4 1.2 1.0 -----|--------------------------------|----------------- | 1.0 1.2 1.4 2.2 2.4 2.6 | 1.6 1.8 2.0 | 1.2 1.0 1.2 2.0 2.2 2.4 | 1.4 1.6 1.8 | 1.4 1.2 1.0 1.8 2.0 2.2 | 1.2 1.4 1.6 1 | 2.2 2.0 1.8 1.0 1.2 1.4 | 1.6 1.4 1.2 | 2.4 2.2 2.0 1.2 1.0 1.2 | 1.8 1.6 1.4 | 2.6 2.4 2.2 1.4 1.2 1.0 | 2.0 1.8 1.6
Output:
Global general 9 × 9 transformed matrix A with block size 3 × 3:
B,D 0 1 2 * * | 2.6 2.4 2.2 | 2.0 1.8 1.6 | 1.4 1.2 1.0 | 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 | 1 | 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 | 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 | * *
The following is the 2 × 2 process grid:
B,D | 0 2 | 1 -----| ------- |----- 1 | P00 | P01 -----| ------- |----- 0 | P10 | P11 2 | |
Local arrays for A:
p,q | 0 | 1 -----|--------------------------------|----------------- | 0.5 -0.3 0.0 1.6 2.0 2.4 | 0.4 0.8 1.2 0 | 0.6 -0.3 0.0 1.2 1.6 2.0 | 0.0 0.4 0.8 | 0.7 -0.2 0.0 0.8 1.2 1.6 | 0.0 0.0 0.4 -----|--------------------------------|----------------- | 2.6 2.4 2.2 1.4 1.2 1.0 | 2.0 1.8 1.6 | 0.4 0.3 0.6 1.7 1.9 2.2 | 0.8 1.1 1.4 | 0.5 -0.4 0.4 2.0 2.4 2.8 | 0.8 1.2 1.6 1 | 0.8 -0.2 0.0 0.4 0.8 1.2 | 0.0 0.0 0.0 | 0.8 -0.1 0.0 0.0 0.4 0.8 | 0.0 0.0 0.0 | 0.9 -0.1 0.0 0.0 0.0 0.4 | 0.0 0.0 0.0
Global vector ipvt of length 9 with block size 3:
B,D 0 * * | 9 | 0 | 9 | | 9 | | -- | | 9 | 1 | 9 | | 9 | | -- | | 9 | 2 | 9 | | 9 | * *
The following is the 2 × 2 process grid:
B,D | | -----| ------- |----- 1 | P00 | P01 -----| ------- |----- 0 | P10 | P11 2 | |
Local arrays for ipvt:
p,q | 0 | 1 -----|-----|----- | 9 | 9 0 | 9 | 9 | 9 | 9 -----|-----|----- | 9 | 9 | 9 | 9 | 9 | 9 1 | 9 | 9 | 9 | 9 | 9 | 9
The value of info is 0 on all processes.
This example factors a 9 × 9 complex matrix using a 2 × 2 process grid. By specifying RSRC_A = 1, the rows of global matrix A and the elements of global vector ipvt are distributed over the process grid starting in the second row of the process grid.
ORDER = 'R' NPROW = 2 NPCOL = 2 CALL BLACS_GET (0, 0, ICONTXT) CALL BLACS_GRIDINIT(ICONTXT, ORDER, NPROW, NPCOL) CALL BLACS_GRIDINFO(ICONTXT, NPROW, NPCOL, MYROW, MYCOL) M N A IA JA DESC_A IPVT INFO | | | | | | | | CALL PZGETRF( 9 , 9 , A , 1 , 1 , DESC_A , IPVT , INFO )
| Desc_A |
---|---|
DTYPE_ | 1 |
CTXT_ | icontxt(IOBG46) |
M_ | 9 |
N_ | 9 |
MB_ | 3 |
NB_ | 3 |
RSRC_ | 1 |
CSRC_ | 0 |
LLD_ | See below(EPSSL46) |
Notes: |
Global general 9 × 9 matrix A with block size 3 × 3:
B,D 0 1 2 * * | (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) | 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) | 1 | (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) | 2 | (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) | * *
The following is the 2 × 2 process grid:
B,D | 0 2 | 1 -----| ------- |----- 1 | P00 | P01 -----| ------- |----- 0 | P10 | P11 2 | |
Local arrays for A:
p,q | 0 | 1 -----|--------------------------------------------------------------------------|-------------------------------------- | (3.2, 1.0) (2.8, 1.0) (2.4, 1.0) (3.2,-1.0) (3.6,-1.0) (4.0,-1.0) | (2.0, 1.0) (2.4,-1.0) (2.8,-1.0) 0 | (3.6, 1.0) (3.2, 1.0) (2.8, 1.0) (2.8,-1.0) (3.2,-1.0) (3.6,-1.0) | (2.4, 1.0) (2.0, 1.0) (2.4,-1.0) | (4.0, 1.0) (3.6, 1.0) (3.2, 1.0) (2.4,-1.0) (2.8,-1.0) (3.2,-1.0) | (2.8, 1.0) (2.4, 1.0) (2.0, 1.0) -----|--------------------------------------------------------------------------|-------------------------------------- | (2.0, 1.0) (2.4,-1.0) (2.8,-1.0) (4.4,-1.0) (4.8,-1.0) (5.2,-1.0) | (3.2,-1.0) (3.6,-1.0) (4.0,-1.0) | (2.4, 1.0) (2.0, 1.0) (2.4,-1.0) (4.0,-1.0) (4.4,-1.0) (4.8,-1.0) | (2.8,-1.0) (3.2,-1.0) (3.6,-1.0) | (2.8, 1.0) (2.4, 1.0) (2.0, 1.0) (3.6,-1.0) (4.0,-1.0) (4.4,-1.0) | (2.4,-1.0) (2.8,-1.0) (3.2,-1.0) 1 | (4.4, 1.0) (4.0, 1.0) (3.6, 1.0) (2.0, 1.0) (2.4,-1.0) (2.8,-1.0) | (3.2, 1.0) (2.8, 1.0) (2.4, 1.0) | (4.8, 1.0) (4.4, 1.0) (4.0, 1.0) (2.4, 1.0) (2.0, 1.0) (2.4,-1.0) | (3.6, 1.0) (3.2, 1.0) (2.8, 1.0) | (5.2, 1.0) (4.8, 1.0) (4.4, 1.0) (2.8, 1.0) (2.4, 1.0) (2.0, 1.0) | (4.0, 1.0) (3.6, 1.0) (3.2, 1.0)
Output:
Global general 9 × 9 transformed matrix A with block size 3 × 3:
B,D 0 1 2 * * | (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 | (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) | 1 | (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) | 2 | (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) | * *
The following is the 2 × 2 process grid:
B,D | 0 2 | 1 -----| ------- |----- 1 | P00 | P01 -----| ------- |----- 0 | P10 | P11 2 | |
Local arrays for A:
p,q | 0 | 1 -----|---------------------------------------------------------------------------|---------------------------------------- | (0.6, 0.1) (0.0,-0.1) (-0.1,-0.1) (2.7,-1.5) (3.4,-1.4) (4.0,-1.2) | (0.7,-1.9) (1.3,-1.7) (2.0,-1.6) 0 | (0.6, 0.1) (0.0,-0.1) (-0.1,-0.1) (2.2,-1.6) (2.9,-1.5) (3.7,-1.3) | (-0.1, 0.0) (0.7,-1.9) (1.5,-1.7) | (0.7, 0.1) (0.0,-0.1) (0.0, 0.0) (1.6,-1.8) (2.4,-1.6) (3.2,-1.5) | (-0.1, 0.0) (-0.1, 0.0) (0.8,-1.9) -----|---------------------------------------------------------------------------|---------------------------------------- | (5.2, 1.0) (4.8, 1.0) (4.4, 1.0) (2.8, 1.0) (2.4, 1.0) (2.0, 1.0) | (4.0, 1.0) (3.6, 1.0) (3.2, 1.0) | (0.4, 0.1) (0.6,-2.0) (1.1,-1.9) (3.4,-1.7) (3.9,-1.7) (4.5,-1.6) | (1.7,-1.9) (2.3,-1.8) (2.8,-1.8) | (0.5, 0.1) (0.0,-0.1) (0.6,-1.9) (3.1,-1.5) (3.7,-1.4) (4.3,-1.3) | (1.2,-1.8) (1.8,-1.7) (2.5,-1.6) 1 | (0.8, 0.0) (0.0, 0.0) (0.0, 0.0) (0.8,-1.9) (1.7,-1.8) (2.5,-1.8) | (0.0, 0.0) (0.0, 0.0) (0.0, 0.0) | (0.9, 0.0) (0.0, 0.0) (0.0, 0.0) (0.0, 0.0) (0.8,-2.0) (1.7,-1.9) | (0.0, 0.0) (0.0, 0.0) (0.0, 0.0) | (0.9, 0.0) (0.0, 0.0) (0.0, 0.0) (0.0, 0.0) (0.0, 0.0) (0.8,-2.0) | (0.0, 0.0) (0.0, 0.0) (0.0, 0.0)
Global vector ipvt of length 9 with block size 3:
B,D 0 * * | 9 | 0 | 9 | | 9 | | -- | | 9 | 1 | 9 | | 9 | | -- | | 9 | 2 | 9 | | 9 | * *
The following is the 2 × 2 process grid:
B,D | 0 2 | 1 -----| ------- |----- 1 | P00 | P01 -----| ------- |----- 0 | P10 | P11 2 | |
Local arrays for ipvt:
p,q | 0 | 1 -----|-----|----- | 9 | 9 0 | 9 | 9 | 9 | 9 -----|-----|----- | 9 | 9 | 9 | 9 | 9 | 9 1 | 9 | 9 | 9 | 9 | 9 | 9
The value of info is 0 on all processes.