LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
ztrtri.f
Go to the documentation of this file.
00001 *> \brief \b ZTRTRI
00002 *
00003 *  =========== DOCUMENTATION ===========
00004 *
00005 * Online html documentation available at 
00006 *            http://www.netlib.org/lapack/explore-html/ 
00007 *
00008 *> \htmlonly
00009 *> Download ZTRTRI + dependencies 
00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/ztrtri.f"> 
00011 *> [TGZ]</a> 
00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/ztrtri.f"> 
00013 *> [ZIP]</a> 
00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/ztrtri.f"> 
00015 *> [TXT]</a>
00016 *> \endhtmlonly 
00017 *
00018 *  Definition:
00019 *  ===========
00020 *
00021 *       SUBROUTINE ZTRTRI( UPLO, DIAG, N, A, LDA, INFO )
00022 * 
00023 *       .. Scalar Arguments ..
00024 *       CHARACTER          DIAG, UPLO
00025 *       INTEGER            INFO, LDA, N
00026 *       ..
00027 *       .. Array Arguments ..
00028 *       COMPLEX*16         A( LDA, * )
00029 *       ..
00030 *  
00031 *
00032 *> \par Purpose:
00033 *  =============
00034 *>
00035 *> \verbatim
00036 *>
00037 *> ZTRTRI computes the inverse of a complex upper or lower triangular
00038 *> matrix A.
00039 *>
00040 *> This is the Level 3 BLAS version of the algorithm.
00041 *> \endverbatim
00042 *
00043 *  Arguments:
00044 *  ==========
00045 *
00046 *> \param[in] UPLO
00047 *> \verbatim
00048 *>          UPLO is CHARACTER*1
00049 *>          = 'U':  A is upper triangular;
00050 *>          = 'L':  A is lower triangular.
00051 *> \endverbatim
00052 *>
00053 *> \param[in] DIAG
00054 *> \verbatim
00055 *>          DIAG is CHARACTER*1
00056 *>          = 'N':  A is non-unit triangular;
00057 *>          = 'U':  A is unit triangular.
00058 *> \endverbatim
00059 *>
00060 *> \param[in] N
00061 *> \verbatim
00062 *>          N is INTEGER
00063 *>          The order of the matrix A.  N >= 0.
00064 *> \endverbatim
00065 *>
00066 *> \param[in,out] A
00067 *> \verbatim
00068 *>          A is COMPLEX*16 array, dimension (LDA,N)
00069 *>          On entry, the triangular matrix A.  If UPLO = 'U', the
00070 *>          leading N-by-N upper triangular part of the array A contains
00071 *>          the upper triangular matrix, and the strictly lower
00072 *>          triangular part of A is not referenced.  If UPLO = 'L', the
00073 *>          leading N-by-N lower triangular part of the array A contains
00074 *>          the lower triangular matrix, and the strictly upper
00075 *>          triangular part of A is not referenced.  If DIAG = 'U', the
00076 *>          diagonal elements of A are also not referenced and are
00077 *>          assumed to be 1.
00078 *>          On exit, the (triangular) inverse of the original matrix, in
00079 *>          the same storage format.
00080 *> \endverbatim
00081 *>
00082 *> \param[in] LDA
00083 *> \verbatim
00084 *>          LDA is INTEGER
00085 *>          The leading dimension of the array A.  LDA >= max(1,N).
00086 *> \endverbatim
00087 *>
00088 *> \param[out] INFO
00089 *> \verbatim
00090 *>          INFO is INTEGER
00091 *>          = 0: successful exit
00092 *>          < 0: if INFO = -i, the i-th argument had an illegal value
00093 *>          > 0: if INFO = i, A(i,i) is exactly zero.  The triangular
00094 *>               matrix is singular and its inverse can not be computed.
00095 *> \endverbatim
00096 *
00097 *  Authors:
00098 *  ========
00099 *
00100 *> \author Univ. of Tennessee 
00101 *> \author Univ. of California Berkeley 
00102 *> \author Univ. of Colorado Denver 
00103 *> \author NAG Ltd. 
00104 *
00105 *> \date November 2011
00106 *
00107 *> \ingroup complex16OTHERcomputational
00108 *
00109 *  =====================================================================
00110       SUBROUTINE ZTRTRI( UPLO, DIAG, N, A, LDA, INFO )
00111 *
00112 *  -- LAPACK computational routine (version 3.4.0) --
00113 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00114 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00115 *     November 2011
00116 *
00117 *     .. Scalar Arguments ..
00118       CHARACTER          DIAG, UPLO
00119       INTEGER            INFO, LDA, N
00120 *     ..
00121 *     .. Array Arguments ..
00122       COMPLEX*16         A( LDA, * )
00123 *     ..
00124 *
00125 *  =====================================================================
00126 *
00127 *     .. Parameters ..
00128       COMPLEX*16         ONE, ZERO
00129       PARAMETER          ( ONE = ( 1.0D+0, 0.0D+0 ),
00130      $                   ZERO = ( 0.0D+0, 0.0D+0 ) )
00131 *     ..
00132 *     .. Local Scalars ..
00133       LOGICAL            NOUNIT, UPPER
00134       INTEGER            J, JB, NB, NN
00135 *     ..
00136 *     .. External Functions ..
00137       LOGICAL            LSAME
00138       INTEGER            ILAENV
00139       EXTERNAL           LSAME, ILAENV
00140 *     ..
00141 *     .. External Subroutines ..
00142       EXTERNAL           XERBLA, ZTRMM, ZTRSM, ZTRTI2
00143 *     ..
00144 *     .. Intrinsic Functions ..
00145       INTRINSIC          MAX, MIN
00146 *     ..
00147 *     .. Executable Statements ..
00148 *
00149 *     Test the input parameters.
00150 *
00151       INFO = 0
00152       UPPER = LSAME( UPLO, 'U' )
00153       NOUNIT = LSAME( DIAG, 'N' )
00154       IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
00155          INFO = -1
00156       ELSE IF( .NOT.NOUNIT .AND. .NOT.LSAME( DIAG, 'U' ) ) THEN
00157          INFO = -2
00158       ELSE IF( N.LT.0 ) THEN
00159          INFO = -3
00160       ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
00161          INFO = -5
00162       END IF
00163       IF( INFO.NE.0 ) THEN
00164          CALL XERBLA( 'ZTRTRI', -INFO )
00165          RETURN
00166       END IF
00167 *
00168 *     Quick return if possible
00169 *
00170       IF( N.EQ.0 )
00171      $   RETURN
00172 *
00173 *     Check for singularity if non-unit.
00174 *
00175       IF( NOUNIT ) THEN
00176          DO 10 INFO = 1, N
00177             IF( A( INFO, INFO ).EQ.ZERO )
00178      $         RETURN
00179    10    CONTINUE
00180          INFO = 0
00181       END IF
00182 *
00183 *     Determine the block size for this environment.
00184 *
00185       NB = ILAENV( 1, 'ZTRTRI', UPLO // DIAG, N, -1, -1, -1 )
00186       IF( NB.LE.1 .OR. NB.GE.N ) THEN
00187 *
00188 *        Use unblocked code
00189 *
00190          CALL ZTRTI2( UPLO, DIAG, N, A, LDA, INFO )
00191       ELSE
00192 *
00193 *        Use blocked code
00194 *
00195          IF( UPPER ) THEN
00196 *
00197 *           Compute inverse of upper triangular matrix
00198 *
00199             DO 20 J = 1, N, NB
00200                JB = MIN( NB, N-J+1 )
00201 *
00202 *              Compute rows 1:j-1 of current block column
00203 *
00204                CALL ZTRMM( 'Left', 'Upper', 'No transpose', DIAG, J-1,
00205      $                     JB, ONE, A, LDA, A( 1, J ), LDA )
00206                CALL ZTRSM( 'Right', 'Upper', 'No transpose', DIAG, J-1,
00207      $                     JB, -ONE, A( J, J ), LDA, A( 1, J ), LDA )
00208 *
00209 *              Compute inverse of current diagonal block
00210 *
00211                CALL ZTRTI2( 'Upper', DIAG, JB, A( J, J ), LDA, INFO )
00212    20       CONTINUE
00213          ELSE
00214 *
00215 *           Compute inverse of lower triangular matrix
00216 *
00217             NN = ( ( N-1 ) / NB )*NB + 1
00218             DO 30 J = NN, 1, -NB
00219                JB = MIN( NB, N-J+1 )
00220                IF( J+JB.LE.N ) THEN
00221 *
00222 *                 Compute rows j+jb:n of current block column
00223 *
00224                   CALL ZTRMM( 'Left', 'Lower', 'No transpose', DIAG,
00225      $                        N-J-JB+1, JB, ONE, A( J+JB, J+JB ), LDA,
00226      $                        A( J+JB, J ), LDA )
00227                   CALL ZTRSM( 'Right', 'Lower', 'No transpose', DIAG,
00228      $                        N-J-JB+1, JB, -ONE, A( J, J ), LDA,
00229      $                        A( J+JB, J ), LDA )
00230                END IF
00231 *
00232 *              Compute inverse of current diagonal block
00233 *
00234                CALL ZTRTI2( 'Lower', DIAG, JB, A( J, J ), LDA, INFO )
00235    30       CONTINUE
00236          END IF
00237       END IF
00238 *
00239       RETURN
00240 *
00241 *     End of ZTRTRI
00242 *
00243       END
 All Files Functions