PDGETRI and PZGETRI compute the inverse of general matrix A. These subroutines use the results of the factorization of matrix A, produced by a preceding call to PDGETRF or PZGETRF, respectively. For details on the factorization, see PDGETRF and PZGETRF--General Matrix Factorization.
If n = 0, no computation is performed and the subroutine
returns after doing some parameter checking.
A, work | ipvt, iwork | Subroutine |
Long-precision real | Integer | PDGETRI |
Long-precision complex | Integer | PZGETRI |
Fortran | CALL PDGETRI | PZGETRI (n, a, ia, ja, desc_a, ipvt, work, lwork, iwork, liwork, info) |
C and C++ | pdgetri | pzgetri (n, a, ia, ja, desc_a, ipvt, work, lwork, iwork, liwork, info); |
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 61. 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+n-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 n = 0: M_A >= 0 Otherwise: M_A >= 1 | Global |
4 | N_A | Number of columns in the global matrix |
If 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.
A copy of the vector ipvt, with a block size of MB_A and global index ia, is contained in each column of the process grid. The process row over which the first row of ipvt is distributed is RSRC_A.
Scope: local
Specified as: an array of (at least) length LOCp(ia+n-1), containing fullword integers, where ia <= (pivoting index values) <= ia+n-1. Details about the block-cyclic data distribution of global vector ipvt are stored in desc_a.
If lwork = 0, work is ignored.
If lwork <> 0, work is a work area used by this subroutine, where:
Scope: local
Specified as: an area of storage containing numbers of data type indicated in Table 61.
Scope:
Specified as: a fullword integer; where:
lwork = NUMROC(n + iroff, MB_A, myrow, iarow, nprow) * NB_A
where:
If liwork = 0, iwork is ignored.
If liwork <> 0, iwork is a work area used by this subroutine, where:
Scope: local
Specified as: an area of storage containing fullword integers.
Scope:
Specified as: a fullword integer; where:
If nprow = npcol, then liwork = nq + NB_A
If nprow <> npcol, then liwork = nq + max(liwork1, liwork2, NB_A)
where:
Scope: local
Returned as: an LLD_A by (at least) LOCq(N_A) array, containing numbers of the data type indicated in Table 61.
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.
Scope: local
Returned as: an area of storage, containing numbers of the data type indicated in Table 61, where:
If lwork >= 1 or lwork = -1, then work1 is set to the minimum lwork value needed. Except for work1, the contents of work are overwritten on return.
If liwork <> 0 and liwork <> -1, then its size is (at least) of length liwork.
If liwork = -1, then its size is (at least) of length 1.
Scope: local
Returned as: an area of storage, where:
If liwork >= 1 or liwork = -1, then iwork1 is set to the minimum liwork value and contains numbers of the data type indicated in Table 61. Except for iwork1, the contents of iwork are overwritten on return.
If info = 0, global submatrix A is not singular, and the inverse completed normally.
If info > 0, global submatrix A is singular and the inverse could not be computed. For info = k, the corresponding diagonal element of Uk, k is exactly zero.
Scope: global
Returned as: a fullword integer; info >= 0.
If, however, you do not plan to call PDGETRI/PZGETRI 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 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:
Also:
This example computes the inverse of a real matrix using the LU factorization computed by PDGETRF. The input ipvt vector and transformed matrix A are the output from PDGETRF, Example 1.
Because lwork = 0 and liwork = 0, PDGETRI dynamically allocates the work areas used by this subroutine.
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) N A IA JA DESC_A IPVT WORK LWORK IWORK LIWORK INFO | | | | | | | | | | | CALL PDGETRI( 9 , A , 1 , 1 ,DESC_A ,IPVT, WORK , 0 , IWORK , 0 , INFO )
| Desc_A |
---|---|
DTYPE_ | 1 |
CTXT_ | icontxt(IOBG50) |
M_ | 9 |
N_ | 9 |
MB_ | 3 |
NB_ | 3 |
RSRC_ | 1 |
CSRC_ | 0 |
LLD_ | See below(EPSSL50) |
Notes: |
Output:
Global general 9 × 9 inverted matrix A with block size 3 × 3:
B,D 0 1 2 * * | -2.4 2.5 0.0 | 0.0 0.0 0.0 | 0.0 0.0 0.1 | 0 | 2.5 -5.0 2.5 | 0.0 0.0 0.0 | 0.0 0.0 0.0 | | 0.0 2.5 -5.0 | 2.5 0.0 0.0 | 0.0 0.0 0.0 | | ----------------|------------------|---------------- | | 0.0 0.0 2.5 | -5.0 2.5 0.0 | 0.0 0.0 0.0 | 1 | 0.0 0.0 0.0 | 2.5 -5.0 2.5 | 0.0 0.0 0.0 | | 0.0 0.0 0.0 | 0.0 2.5 -5.0 | 2.5 0.0 0.0 | | ----------------|------------------|---------------- | | 0.0 0.0 0.0 | 0.0 0.0 2.5 | -5.0 2.5 0.0 | 2 | 0.0 0.0 0.0 | 0.0 0.0 0.0 | 2.5 -5.0 2.5 | | 0.1 0.0 0.0 | 0.0 0.0 0.0 | 0.0 2.5 -2.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.0 0.0 2.5 0.0 0.0 0.0 | -5.0 2.5 0.0 0 | 0.0 0.0 0.0 0.0 0.0 0.0 | 2.5 -5.0 2.5 | 0.0 0.0 0.0 2.5 0.0 0.0 | 0.0 2.5 -5.0 -----|--------------------------------|----------------- | -2.4 2.5 0.0 0.0 0.0 0.1 | 0.0 0.0 0.0 | 2.5 -5.0 2.5 0.0 0.0 0.0 | 0.0 0.0 0.0 | 0.0 2.5 -5.0 0.0 0.0 0.0 | 2.5 0.0 0.0 1 | 0.0 0.0 0.0 -5.0 2.5 0.0 | 0.0 0.0 2.5 | 0.0 0.0 0.0 2.5 -5.0 2.5 | 0.0 0.0 0.0 | 0.1 0.0 0.0 0.0 2.5 -2.4 | 0.0 0.0 0.0
The value of info is 0 on all processes.
This example computes the inverse of a complex matrix using the LU factorization computed by PZGETRF. The input ipvt vector and transformed matrix A are the output from PZGETRF, Example 2.
Because lwork = 0 and liwork = 0, PZGETRI dynamically allocates the work areas used by this subroutine.
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) N A IA JA DESC_A IPVT WORK LWORK IWORK LIWORK INFO | | | | | | | | | | | CALL PZGETRI( 9 , A , 1 , 1 ,DESC_A ,IPVT ,WORK , 0 , IWORK , 0 , INFO )
| Desc_A |
---|---|
DTYPE_ | 1 |
CTXT_ | icontxt(IOBG51) |
M_ | 9 |
N_ | 9 |
MB_ | 3 |
NB_ | 3 |
RSRC_ | 1 |
CSRC_ | 0 |
LLD_A | See below(EPSSL51) |
Notes: |
Output:
Global general 9 × 9 inverted complex matrix A with block size 3 × 3:
B,D 0 1 2 * * |(-.17,-.42) (-.12, .13) (-.06, .15) | (.00, .15) (.05, .13) (.09, .09) | (.11, .05) (.11, .00) (.04,-.28) | 0 | (.18, .43) (-.04,-.55) (-.06,-.03) |(-.06,-.01) (-.05, .01) (-.04, .03) |(-.03, .04) (-.01, .04) (.11, .00) | | (.01, .00) (.18, .43) (-.04,-.55) |(-.06,-.03) (-.06,-.01) (-.05, .01) |(-.04, .03) (-.03, .04) (.11, .05) | | ------------------------------------|-------------------------------------|----------------------------------- | | (.01, .00) (.01, .00) (.18, .43) |(-.04,-.55) (-.06,-.03) (-.06,-.01) |(-.05, .01) (-.04, .03) (.09, .09) | 1 | (.00, .01) (.01, .00) (.01, .00) | (.18, .43) (-.04,-.55) (-.06,-.03) |(-.06,-.01) (-.05, .01) (.05, .13) | | (.00, .01) (.00, .01) (.01, .00) | (.01, .00) (.18, .43) (-.04,-.55) |(-.06,-.03) (-.06,-.01) (.00, .15) | | ------------------------------------|-------------------------------------|----------------------------------- | | (.00, .01) (.00, .01) (.00, .01) | (.01, .00) (.01, .00) (.18, .43) |(-.04,-.55) (-.06,-.03) (-.06, .15) | 2 | (.00, .01) (.00, .01) (.00, .01) | (.00, .01) (.01, .00) (.01, .00) | (.18, .43) (-.04,-.55) (-.12, .13) | |(-.01, .01) (.00, .01) (.00, .01) | (.00, .01) (.00, .01) (.01, .00) | (.01, .00) (.18, .43) (-.17,-.42) | * *
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 -----|-------------------------------------------------------------------------|----------------------------------- | (.01, .00) (.01, .00) (.18, .43) (-.05, .01) (-.04, .03) (.09, .09) |(-.04,-.55) (-.06,-.03) (-.06,-.01) 0 | (.00, .01) (.01, .00) (.01, .00) (-.06,-.01) (-.05, .01) (.05, .13) | (.18, .43) (-.04,-.55) (-.06,-.03) | (.00, .01) (.00, .01) (.01, .00) (-.06,-.03) (-.06,-.01) (.00, .15) | (.01, .00) (.18, .43) (-.04,-.55) -----|-------------------------------------------------------------------------|----------------------------------- |(-.17,-.42) (-.12, .13) (-.06, .15) (.11, .05) (.11, .00) (.04,-.28) | (.00, .15) (.05, .13) (.09, .09) | (.18, .43) (-.04,-.55) (-.06,-.03) (-.03, .04) (-.01, .04) (.11, .00) |(-.06,-.01) (-.05, .01) (-.04, .03) | (.01, .00) (.18, .43) (-.04,-.55) (-.04, .03) (-.03, .04) (.11, .05) |(-.06,-.03) (-.06,-.01) (-.05, .01) 1 | (.00, .01) (.00, .01) (.00, .01) (-.04,-.55) (-.06,-.03) (-.06, .15) | (.01, .00) (.01, .00) (.18, .43) | (.00, .01) (.00, .01) (.00, .01) (.18, .43) (-.04,-.55) (-.12, .13) | (.00, .01) (.01, .00) (.01, .00) |(-.01, .01) (.00, .01) (.00, .01) (.01, .00) (.18, .43) (-.17,-.42) | (.00, .01) (.00, .01) (.01, .00)
The value of info is 0 on all processes.