ScaLAPACK  2.0.2
ScaLAPACK: Scalable Linear Algebra PACKage
pcpotri.f
Go to the documentation of this file.
00001       SUBROUTINE PCPOTRI( UPLO, N, A, IA, JA, DESCA, INFO )
00002 *
00003 *  -- ScaLAPACK routine (version 1.7) --
00004 *     University of Tennessee, Knoxville, Oak Ridge National Laboratory,
00005 *     and University of California, Berkeley.
00006 *     May 1, 1997
00007 *
00008 *     .. Scalar Arguments ..
00009       CHARACTER          UPLO
00010       INTEGER            IA, INFO, JA, N
00011 *     ..
00012 *     .. Array Arguments ..
00013       INTEGER            DESCA( * )
00014       COMPLEX            A( * )
00015 *     ..
00016 *
00017 *  Purpose
00018 *  =======
00019 *
00020 *  PCPOTRI computes the inverse of a complex Hermitian positive definite
00021 *  distributed matrix sub( A ) = A(IA:IA+N-1,JA:JA+N-1) using the
00022 *  Cholesky factorization sub( A ) = U**H*U or L*L**H computed by
00023 *  PCPOTRF.
00024 *
00025 *  Notes
00026 *  =====
00027 *
00028 *  Each global data object is described by an associated description
00029 *  vector.  This vector stores the information required to establish
00030 *  the mapping between an object element and its corresponding process
00031 *  and memory location.
00032 *
00033 *  Let A be a generic term for any 2D block cyclicly distributed array.
00034 *  Such a global array has an associated description vector DESCA.
00035 *  In the following comments, the character _ should be read as
00036 *  "of the global array".
00037 *
00038 *  NOTATION        STORED IN      EXPLANATION
00039 *  --------------- -------------- --------------------------------------
00040 *  DTYPE_A(global) DESCA( DTYPE_ )The descriptor type.  In this case,
00041 *                                 DTYPE_A = 1.
00042 *  CTXT_A (global) DESCA( CTXT_ ) The BLACS context handle, indicating
00043 *                                 the BLACS process grid A is distribu-
00044 *                                 ted over. The context itself is glo-
00045 *                                 bal, but the handle (the integer
00046 *                                 value) may vary.
00047 *  M_A    (global) DESCA( M_ )    The number of rows in the global
00048 *                                 array A.
00049 *  N_A    (global) DESCA( N_ )    The number of columns in the global
00050 *                                 array A.
00051 *  MB_A   (global) DESCA( MB_ )   The blocking factor used to distribute
00052 *                                 the rows of the array.
00053 *  NB_A   (global) DESCA( NB_ )   The blocking factor used to distribute
00054 *                                 the columns of the array.
00055 *  RSRC_A (global) DESCA( RSRC_ ) The process row over which the first
00056 *                                 row of the array A is distributed.
00057 *  CSRC_A (global) DESCA( CSRC_ ) The process column over which the
00058 *                                 first column of the array A is
00059 *                                 distributed.
00060 *  LLD_A  (local)  DESCA( LLD_ )  The leading dimension of the local
00061 *                                 array.  LLD_A >= MAX(1,LOCr(M_A)).
00062 *
00063 *  Let K be the number of rows or columns of a distributed matrix,
00064 *  and assume that its process grid has dimension p x q.
00065 *  LOCr( K ) denotes the number of elements of K that a process
00066 *  would receive if K were distributed over the p processes of its
00067 *  process column.
00068 *  Similarly, LOCc( K ) denotes the number of elements of K that a
00069 *  process would receive if K were distributed over the q processes of
00070 *  its process row.
00071 *  The values of LOCr() and LOCc() may be determined via a call to the
00072 *  ScaLAPACK tool function, NUMROC:
00073 *          LOCr( M ) = NUMROC( M, MB_A, MYROW, RSRC_A, NPROW ),
00074 *          LOCc( N ) = NUMROC( N, NB_A, MYCOL, CSRC_A, NPCOL ).
00075 *  An upper bound for these quantities may be computed by:
00076 *          LOCr( M ) <= ceil( ceil(M/MB_A)/NPROW )*MB_A
00077 *          LOCc( N ) <= ceil( ceil(N/NB_A)/NPCOL )*NB_A
00078 *
00079 *  Arguments
00080 *  =========
00081 *
00082 *  UPLO    (global input) CHARACTER*1
00083 *          = 'U':  Upper triangle of sub( A ) is stored;
00084 *          = 'L':  Lower triangle of sub( A ) is stored.
00085 *
00086 *  N       (global input) INTEGER
00087 *          The number of rows and columns to be operated on, i.e. the
00088 *          order of the distributed submatrix sub( A ). N >= 0.
00089 *
00090 *  A       (local input/local output) COMPLEX pointer into the
00091 *          local memory to an array of dimension (LLD_A, LOCc(JA+N-1)).
00092 *          On entry, the local pieces of the triangular factor U or L
00093 *          from the Cholesky factorization of the distributed matrix
00094 *          sub( A ) = U**H*U or  L*L**H, as computed by PCPOTRF.
00095 *          On exit, the local pieces of the upper or lower triangle of
00096 *          the (Hermitian) inverse of sub( A ), overwriting the input
00097 *          factor U or L.
00098 *
00099 *  IA      (global input) INTEGER
00100 *          The row index in the global array A indicating the first
00101 *          row of sub( A ).
00102 *
00103 *  JA      (global input) INTEGER
00104 *          The column index in the global array A indicating the
00105 *          first column of sub( A ).
00106 *
00107 *  DESCA   (global and local input) INTEGER array of dimension DLEN_.
00108 *          The array descriptor for the distributed matrix A.
00109 *
00110 *  INFO    (global output) INTEGER
00111 *          = 0:  successful exit
00112 *          < 0:  If the i-th argument is an array and the j-entry had
00113 *                an illegal value, then INFO = -(i*100+j), if the i-th
00114 *                argument is a scalar and had an illegal value, then
00115 *                INFO = -i.
00116 *          > 0:  If INFO = i, the (i,i) element of the factor U or L is
00117 *                zero, and the inverse could not be computed.
00118 *
00119 *  =====================================================================
00120 *
00121 *     .. Parameters ..
00122       INTEGER            BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
00123      $                   LLD_, MB_, M_, NB_, N_, RSRC_
00124       PARAMETER          ( BLOCK_CYCLIC_2D = 1, DLEN_ = 9, DTYPE_ = 1,
00125      $                     CTXT_ = 2, M_ = 3, N_ = 4, MB_ = 5, NB_ = 6,
00126      $                     RSRC_ = 7, CSRC_ = 8, LLD_ = 9 )
00127 *     ..
00128 *     .. Local Scalars ..
00129       LOGICAL            UPPER
00130       INTEGER            ICOFF, ICTXT, IROFF, MYCOL, MYROW, NPCOL, NPROW
00131 *     ..
00132 *     .. Local Arrays ..
00133       INTEGER            IDUM1( 1 ), IDUM2( 1 )
00134 *     ..
00135 *     .. External Subroutines ..
00136       EXTERNAL           BLACS_GRIDINFO, CHK1MAT, PCHK1MAT, PCLAUUM,
00137      $                   PCTRTRI, PXERBLA
00138 *     ..
00139 *     .. External Functions ..
00140       LOGICAL            LSAME
00141       EXTERNAL           LSAME
00142 *     ..
00143 *     .. Intrinsic Functions ..
00144       INTRINSIC          ICHAR, MOD
00145 *     ..
00146 *     .. Executable Statements ..
00147 *
00148 *     Get grid parameters
00149 *
00150       ICTXT = DESCA( CTXT_ )
00151       CALL BLACS_GRIDINFO( ICTXT, NPROW, NPCOL, MYROW, MYCOL )
00152 *
00153 *     Test the input parameters
00154 *
00155       INFO = 0
00156       IF( NPROW.EQ.-1 ) THEN
00157          INFO = -(600+CTXT_)
00158       ELSE
00159          UPPER = LSAME( UPLO, 'U' )
00160          CALL CHK1MAT( N, 2, N, 2, IA, JA, DESCA, 6, INFO )
00161          IF( INFO.NE.0 ) THEN
00162             IROFF = MOD( IA-1, DESCA( MB_ ) )
00163             ICOFF = MOD( JA-1, DESCA( NB_ ) )
00164             IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
00165                INFO = -1
00166             ELSE IF( IROFF.NE.ICOFF .OR. IROFF.NE.0 ) THEN
00167                INFO = -5
00168             ELSE IF( DESCA( MB_ ).NE.DESCA( NB_ ) ) THEN
00169                INFO = -(600+NB_)
00170             END IF
00171          END IF
00172 *
00173          IF( UPPER ) THEN
00174             IDUM1( 1 ) = ICHAR( 'U' )
00175          ELSE
00176             IDUM1( 1 ) = ICHAR( 'L' )
00177          END IF
00178          IDUM2( 1 ) = 1
00179          CALL PCHK1MAT( N, 2, N, 2, IA, JA, DESCA, 6, 1, IDUM1, IDUM2,
00180      $                  INFO )
00181       END IF
00182 *
00183       IF( INFO.NE.0 ) THEN
00184          CALL PXERBLA( ICTXT, 'PCPOTRI', -INFO )
00185          RETURN
00186       END IF
00187 *
00188 *     Quick return if possible
00189 *
00190       IF( N.EQ.0 )
00191      $   RETURN
00192 *
00193 *     Invert the triangular Cholesky factor U or L.
00194 *
00195       CALL PCTRTRI( UPLO, 'Non-unit', N, A, IA, JA, DESCA, INFO )
00196 *
00197       IF( INFO.GT.0 )
00198      $   RETURN
00199 *
00200 *     Form inv(U)*inv(U)' or inv(L)'*inv(L).
00201 *
00202       CALL PCLAUUM( UPLO, N, A, IA, JA, DESCA )
00203 *
00204       RETURN
00205 *
00206 *     End of PCPOTRI
00207 *
00208       END