Annotation of rpl/lapack/lapack/ztrtri.f, revision 1.15

1.8       bertrand    1: *> \brief \b ZTRTRI
                      2: *
                      3: *  =========== DOCUMENTATION ===========
                      4: *
1.14      bertrand    5: * Online html documentation available at
                      6: *            http://www.netlib.org/lapack/explore-html/
1.8       bertrand    7: *
                      8: *> \htmlonly
1.14      bertrand    9: *> Download ZTRTRI + dependencies
                     10: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/ztrtri.f">
                     11: *> [TGZ]</a>
                     12: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/ztrtri.f">
                     13: *> [ZIP]</a>
                     14: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/ztrtri.f">
1.8       bertrand   15: *> [TXT]</a>
1.14      bertrand   16: *> \endhtmlonly
1.8       bertrand   17: *
                     18: *  Definition:
                     19: *  ===========
                     20: *
                     21: *       SUBROUTINE ZTRTRI( UPLO, DIAG, N, A, LDA, INFO )
1.14      bertrand   22: *
1.8       bertrand   23: *       .. Scalar Arguments ..
                     24: *       CHARACTER          DIAG, UPLO
                     25: *       INTEGER            INFO, LDA, N
                     26: *       ..
                     27: *       .. Array Arguments ..
                     28: *       COMPLEX*16         A( LDA, * )
                     29: *       ..
1.14      bertrand   30: *
1.8       bertrand   31: *
                     32: *> \par Purpose:
                     33: *  =============
                     34: *>
                     35: *> \verbatim
                     36: *>
                     37: *> ZTRTRI computes the inverse of a complex upper or lower triangular
                     38: *> matrix A.
                     39: *>
                     40: *> This is the Level 3 BLAS version of the algorithm.
                     41: *> \endverbatim
                     42: *
                     43: *  Arguments:
                     44: *  ==========
                     45: *
                     46: *> \param[in] UPLO
                     47: *> \verbatim
                     48: *>          UPLO is CHARACTER*1
                     49: *>          = 'U':  A is upper triangular;
                     50: *>          = 'L':  A is lower triangular.
                     51: *> \endverbatim
                     52: *>
                     53: *> \param[in] DIAG
                     54: *> \verbatim
                     55: *>          DIAG is CHARACTER*1
                     56: *>          = 'N':  A is non-unit triangular;
                     57: *>          = 'U':  A is unit triangular.
                     58: *> \endverbatim
                     59: *>
                     60: *> \param[in] N
                     61: *> \verbatim
                     62: *>          N is INTEGER
                     63: *>          The order of the matrix A.  N >= 0.
                     64: *> \endverbatim
                     65: *>
                     66: *> \param[in,out] A
                     67: *> \verbatim
                     68: *>          A is COMPLEX*16 array, dimension (LDA,N)
                     69: *>          On entry, the triangular matrix A.  If UPLO = 'U', the
                     70: *>          leading N-by-N upper triangular part of the array A contains
                     71: *>          the upper triangular matrix, and the strictly lower
                     72: *>          triangular part of A is not referenced.  If UPLO = 'L', the
                     73: *>          leading N-by-N lower triangular part of the array A contains
                     74: *>          the lower triangular matrix, and the strictly upper
                     75: *>          triangular part of A is not referenced.  If DIAG = 'U', the
                     76: *>          diagonal elements of A are also not referenced and are
                     77: *>          assumed to be 1.
                     78: *>          On exit, the (triangular) inverse of the original matrix, in
                     79: *>          the same storage format.
                     80: *> \endverbatim
                     81: *>
                     82: *> \param[in] LDA
                     83: *> \verbatim
                     84: *>          LDA is INTEGER
                     85: *>          The leading dimension of the array A.  LDA >= max(1,N).
                     86: *> \endverbatim
                     87: *>
                     88: *> \param[out] INFO
                     89: *> \verbatim
                     90: *>          INFO is INTEGER
                     91: *>          = 0: successful exit
                     92: *>          < 0: if INFO = -i, the i-th argument had an illegal value
                     93: *>          > 0: if INFO = i, A(i,i) is exactly zero.  The triangular
                     94: *>               matrix is singular and its inverse can not be computed.
                     95: *> \endverbatim
                     96: *
                     97: *  Authors:
                     98: *  ========
                     99: *
1.14      bertrand  100: *> \author Univ. of Tennessee
                    101: *> \author Univ. of California Berkeley
                    102: *> \author Univ. of Colorado Denver
                    103: *> \author NAG Ltd.
1.8       bertrand  104: *
1.14      bertrand  105: *> \date December 2016
1.8       bertrand  106: *
                    107: *> \ingroup complex16OTHERcomputational
                    108: *
                    109: *  =====================================================================
1.1       bertrand  110:       SUBROUTINE ZTRTRI( UPLO, DIAG, N, A, LDA, INFO )
                    111: *
1.14      bertrand  112: *  -- LAPACK computational routine (version 3.7.0) --
1.1       bertrand  113: *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
                    114: *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
1.14      bertrand  115: *     December 2016
1.1       bertrand  116: *
                    117: *     .. Scalar Arguments ..
                    118:       CHARACTER          DIAG, UPLO
                    119:       INTEGER            INFO, LDA, N
                    120: *     ..
                    121: *     .. Array Arguments ..
                    122:       COMPLEX*16         A( LDA, * )
                    123: *     ..
                    124: *
                    125: *  =====================================================================
                    126: *
                    127: *     .. Parameters ..
                    128:       COMPLEX*16         ONE, ZERO
                    129:       PARAMETER          ( ONE = ( 1.0D+0, 0.0D+0 ),
                    130:      $                   ZERO = ( 0.0D+0, 0.0D+0 ) )
                    131: *     ..
                    132: *     .. Local Scalars ..
                    133:       LOGICAL            NOUNIT, UPPER
                    134:       INTEGER            J, JB, NB, NN
                    135: *     ..
                    136: *     .. External Functions ..
                    137:       LOGICAL            LSAME
                    138:       INTEGER            ILAENV
                    139:       EXTERNAL           LSAME, ILAENV
                    140: *     ..
                    141: *     .. External Subroutines ..
                    142:       EXTERNAL           XERBLA, ZTRMM, ZTRSM, ZTRTI2
                    143: *     ..
                    144: *     .. Intrinsic Functions ..
                    145:       INTRINSIC          MAX, MIN
                    146: *     ..
                    147: *     .. Executable Statements ..
                    148: *
                    149: *     Test the input parameters.
                    150: *
                    151:       INFO = 0
                    152:       UPPER = LSAME( UPLO, 'U' )
                    153:       NOUNIT = LSAME( DIAG, 'N' )
                    154:       IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
                    155:          INFO = -1
                    156:       ELSE IF( .NOT.NOUNIT .AND. .NOT.LSAME( DIAG, 'U' ) ) THEN
                    157:          INFO = -2
                    158:       ELSE IF( N.LT.0 ) THEN
                    159:          INFO = -3
                    160:       ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
                    161:          INFO = -5
                    162:       END IF
                    163:       IF( INFO.NE.0 ) THEN
                    164:          CALL XERBLA( 'ZTRTRI', -INFO )
                    165:          RETURN
                    166:       END IF
                    167: *
                    168: *     Quick return if possible
                    169: *
                    170:       IF( N.EQ.0 )
                    171:      $   RETURN
                    172: *
                    173: *     Check for singularity if non-unit.
                    174: *
                    175:       IF( NOUNIT ) THEN
                    176:          DO 10 INFO = 1, N
                    177:             IF( A( INFO, INFO ).EQ.ZERO )
                    178:      $         RETURN
                    179:    10    CONTINUE
                    180:          INFO = 0
                    181:       END IF
                    182: *
                    183: *     Determine the block size for this environment.
                    184: *
                    185:       NB = ILAENV( 1, 'ZTRTRI', UPLO // DIAG, N, -1, -1, -1 )
                    186:       IF( NB.LE.1 .OR. NB.GE.N ) THEN
                    187: *
                    188: *        Use unblocked code
                    189: *
                    190:          CALL ZTRTI2( UPLO, DIAG, N, A, LDA, INFO )
                    191:       ELSE
                    192: *
                    193: *        Use blocked code
                    194: *
                    195:          IF( UPPER ) THEN
                    196: *
                    197: *           Compute inverse of upper triangular matrix
                    198: *
                    199:             DO 20 J = 1, N, NB
                    200:                JB = MIN( NB, N-J+1 )
                    201: *
                    202: *              Compute rows 1:j-1 of current block column
                    203: *
                    204:                CALL ZTRMM( 'Left', 'Upper', 'No transpose', DIAG, J-1,
                    205:      $                     JB, ONE, A, LDA, A( 1, J ), LDA )
                    206:                CALL ZTRSM( 'Right', 'Upper', 'No transpose', DIAG, J-1,
                    207:      $                     JB, -ONE, A( J, J ), LDA, A( 1, J ), LDA )
                    208: *
                    209: *              Compute inverse of current diagonal block
                    210: *
                    211:                CALL ZTRTI2( 'Upper', DIAG, JB, A( J, J ), LDA, INFO )
                    212:    20       CONTINUE
                    213:          ELSE
                    214: *
                    215: *           Compute inverse of lower triangular matrix
                    216: *
                    217:             NN = ( ( N-1 ) / NB )*NB + 1
                    218:             DO 30 J = NN, 1, -NB
                    219:                JB = MIN( NB, N-J+1 )
                    220:                IF( J+JB.LE.N ) THEN
                    221: *
                    222: *                 Compute rows j+jb:n of current block column
                    223: *
                    224:                   CALL ZTRMM( 'Left', 'Lower', 'No transpose', DIAG,
                    225:      $                        N-J-JB+1, JB, ONE, A( J+JB, J+JB ), LDA,
                    226:      $                        A( J+JB, J ), LDA )
                    227:                   CALL ZTRSM( 'Right', 'Lower', 'No transpose', DIAG,
                    228:      $                        N-J-JB+1, JB, -ONE, A( J, J ), LDA,
                    229:      $                        A( J+JB, J ), LDA )
                    230:                END IF
                    231: *
                    232: *              Compute inverse of current diagonal block
                    233: *
                    234:                CALL ZTRTI2( 'Lower', DIAG, JB, A( J, J ), LDA, INFO )
                    235:    30       CONTINUE
                    236:          END IF
                    237:       END IF
                    238: *
                    239:       RETURN
                    240: *
                    241: *     End of ZTRTRI
                    242: *
                    243:       END

CVSweb interface <joel.bertrand@systella.fr>