LAPACK 3.3.1 Linear Algebra PACKage

# zhetri2.f

Go to the documentation of this file.
```00001       SUBROUTINE ZHETRI2( UPLO, N, A, LDA, IPIV, WORK, LWORK, INFO )
00002 *
00003 *  -- LAPACK routine (version 3.3.1) --
00004 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00005 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00006 *  -- April 2011                                                      --
00007 *
00008 *  -- Written by Julie Langou of the Univ. of TN    --
00009 *
00010 * @precisions normal z -> c
00011 *
00012 *     .. Scalar Arguments ..
00013       CHARACTER          UPLO
00014       INTEGER            INFO, LDA, LWORK, N
00015 *     ..
00016 *     .. Array Arguments ..
00017       INTEGER            IPIV( * )
00018       COMPLEX*16         A( LDA, * ), WORK( * )
00019 *     ..
00020 *
00021 *  Purpose
00022 *  =======
00023 *
00024 *  ZHETRI2 computes the inverse of a COMPLEX*16 hermitian indefinite matrix
00025 *  A using the factorization A = U*D*U**T or A = L*D*L**T computed by
00026 *  ZHETRF. ZHETRI2 set the LEADING DIMENSION of the workspace
00027 *  before calling ZHETRI2X that actually computes the inverse.
00028 *
00029 *  Arguments
00030 *  =========
00031 *
00032 *  UPLO    (input) CHARACTER*1
00033 *          Specifies whether the details of the factorization are stored
00034 *          as an upper or lower triangular matrix.
00035 *          = 'U':  Upper triangular, form is A = U*D*U**T;
00036 *          = 'L':  Lower triangular, form is A = L*D*L**T.
00037 *
00038 *  N       (input) INTEGER
00039 *          The order of the matrix A.  N >= 0.
00040 *
00041 *  A       (input/output) COMPLEX*16 array, dimension (LDA,N)
00042 *          On entry, the NB diagonal matrix D and the multipliers
00043 *          used to obtain the factor U or L as computed by ZHETRF.
00044 *
00045 *          On exit, if INFO = 0, the (symmetric) inverse of the original
00046 *          matrix.  If UPLO = 'U', the upper triangular part of the
00047 *          inverse is formed and the part of A below the diagonal is not
00048 *          referenced; if UPLO = 'L' the lower triangular part of the
00049 *          inverse is formed and the part of A above the diagonal is
00050 *          not referenced.
00051 *
00052 *  LDA     (input) INTEGER
00053 *          The leading dimension of the array A.  LDA >= max(1,N).
00054 *
00055 *  IPIV    (input) INTEGER array, dimension (N)
00056 *          Details of the interchanges and the NB structure of D
00057 *          as determined by ZHETRF.
00058 *
00059 *  WORK    (workspace) COMPLEX*16 array, dimension (N+NB+1)*(NB+3)
00060 *
00061 *  LWORK   (input) INTEGER
00062 *          The dimension of the array WORK.
00063 *          WORK is size >= (N+NB+1)*(NB+3)
00064 *          If LDWORK = -1, then a workspace query is assumed; the routine
00065 *           calculates:
00066 *              - the optimal size of the WORK array, returns
00067 *          this value as the first entry of the WORK array,
00068 *              - and no error message related to LDWORK is issued by XERBLA.
00069 *
00070 *  INFO    (output) INTEGER
00071 *          = 0: successful exit
00072 *          < 0: if INFO = -i, the i-th argument had an illegal value
00073 *          > 0: if INFO = i, D(i,i) = 0; the matrix is singular and its
00074 *               inverse could not be computed.
00075 *
00076 *  =====================================================================
00077 *
00078 *     .. Local Scalars ..
00079       LOGICAL            UPPER, LQUERY
00080       INTEGER            MINSIZE, NBMAX
00081 *     ..
00082 *     .. External Functions ..
00083       LOGICAL            LSAME
00084       INTEGER            ILAENV
00085       EXTERNAL           LSAME, ILAENV
00086 *     ..
00087 *     .. External Subroutines ..
00088       EXTERNAL           ZHETRI2X
00089 *     ..
00090 *     .. Executable Statements ..
00091 *
00092 *     Test the input parameters.
00093 *
00094       INFO = 0
00095       UPPER = LSAME( UPLO, 'U' )
00096       LQUERY = ( LWORK.EQ.-1 )
00097 *     Get blocksize
00098       NBMAX = ILAENV( 1, 'ZHETRF', UPLO, N, -1, -1, -1 )
00099       IF ( NBMAX .GE. N ) THEN
00100          MINSIZE = N
00101       ELSE
00102          MINSIZE = (N+NBMAX+1)*(NBMAX+3)
00103       END IF
00104 *
00105       IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
00106          INFO = -1
00107       ELSE IF( N.LT.0 ) THEN
00108          INFO = -2
00109       ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
00110          INFO = -4
00111       ELSE IF (LWORK .LT. MINSIZE .AND. .NOT.LQUERY ) THEN
00112          INFO = -7
00113       END IF
00114 *
00115 *     Quick return if possible
00116 *
00117 *
00118       IF( INFO.NE.0 ) THEN
00119          CALL XERBLA( 'ZHETRI2', -INFO )
00120          RETURN
00121       ELSE IF( LQUERY ) THEN
00122          WORK(1)=MINSIZE
00123          RETURN
00124       END IF
00125       IF( N.EQ.0 )
00126      \$   RETURN
00127
00128       IF( NBMAX .GE. N ) THEN
00129          CALL ZHETRI( UPLO, N, A, LDA, IPIV, WORK, INFO )
00130       ELSE
00131          CALL ZHETRI2X( UPLO, N, A, LDA, IPIV, WORK, NBMAX, INFO )
00132       END IF
00133       RETURN
00134 *
00135 *     End of ZHETRI2
00136 *
00137       END
```