LAPACK 3.3.1
Linear Algebra PACKage
|
00001 SUBROUTINE ZPOTRF( UPLO, N, A, LDA, 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 * .. Scalar Arguments .. 00009 CHARACTER UPLO 00010 INTEGER INFO, LDA, N 00011 * .. 00012 * .. Array Arguments .. 00013 COMPLEX*16 A( LDA, * ) 00014 * .. 00015 * 00016 * Purpose 00017 * ======= 00018 * 00019 * ZPOTRF computes the Cholesky factorization of a complex Hermitian 00020 * positive definite matrix A. 00021 * 00022 * The factorization has the form 00023 * A = U**H * U, if UPLO = 'U', or 00024 * A = L * L**H, if UPLO = 'L', 00025 * where U is an upper triangular matrix and L is lower triangular. 00026 * 00027 * This is the block version of the algorithm, calling Level 3 BLAS. 00028 * 00029 * Arguments 00030 * ========= 00031 * 00032 * UPLO (input) CHARACTER*1 00033 * = 'U': Upper triangle of A is stored; 00034 * = 'L': Lower triangle of A is stored. 00035 * 00036 * N (input) INTEGER 00037 * The order of the matrix A. N >= 0. 00038 * 00039 * A (input/output) COMPLEX*16 array, dimension (LDA,N) 00040 * On entry, the Hermitian matrix A. If UPLO = 'U', the leading 00041 * N-by-N upper triangular part of A contains the upper 00042 * triangular part of the matrix A, and the strictly lower 00043 * triangular part of A is not referenced. If UPLO = 'L', the 00044 * leading N-by-N lower triangular part of A contains the lower 00045 * triangular part of the matrix A, and the strictly upper 00046 * triangular part of A is not referenced. 00047 * 00048 * On exit, if INFO = 0, the factor U or L from the Cholesky 00049 * factorization A = U**H *U or A = L*L**H. 00050 * 00051 * LDA (input) INTEGER 00052 * The leading dimension of the array A. LDA >= max(1,N). 00053 * 00054 * INFO (output) INTEGER 00055 * = 0: successful exit 00056 * < 0: if INFO = -i, the i-th argument had an illegal value 00057 * > 0: if INFO = i, the leading minor of order i is not 00058 * positive definite, and the factorization could not be 00059 * completed. 00060 * 00061 * ===================================================================== 00062 * 00063 * .. Parameters .. 00064 DOUBLE PRECISION ONE 00065 COMPLEX*16 CONE 00066 PARAMETER ( ONE = 1.0D+0, CONE = ( 1.0D+0, 0.0D+0 ) ) 00067 * .. 00068 * .. Local Scalars .. 00069 LOGICAL UPPER 00070 INTEGER J, JB, NB 00071 * .. 00072 * .. External Functions .. 00073 LOGICAL LSAME 00074 INTEGER ILAENV 00075 EXTERNAL LSAME, ILAENV 00076 * .. 00077 * .. External Subroutines .. 00078 EXTERNAL XERBLA, ZGEMM, ZHERK, ZPOTF2, ZTRSM 00079 * .. 00080 * .. Intrinsic Functions .. 00081 INTRINSIC MAX, MIN 00082 * .. 00083 * .. Executable Statements .. 00084 * 00085 * Test the input parameters. 00086 * 00087 INFO = 0 00088 UPPER = LSAME( UPLO, 'U' ) 00089 IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN 00090 INFO = -1 00091 ELSE IF( N.LT.0 ) THEN 00092 INFO = -2 00093 ELSE IF( LDA.LT.MAX( 1, N ) ) THEN 00094 INFO = -4 00095 END IF 00096 IF( INFO.NE.0 ) THEN 00097 CALL XERBLA( 'ZPOTRF', -INFO ) 00098 RETURN 00099 END IF 00100 * 00101 * Quick return if possible 00102 * 00103 IF( N.EQ.0 ) 00104 $ RETURN 00105 * 00106 * Determine the block size for this environment. 00107 * 00108 NB = ILAENV( 1, 'ZPOTRF', UPLO, N, -1, -1, -1 ) 00109 IF( NB.LE.1 .OR. NB.GE.N ) THEN 00110 * 00111 * Use unblocked code. 00112 * 00113 CALL ZPOTF2( UPLO, N, A, LDA, INFO ) 00114 ELSE 00115 * 00116 * Use blocked code. 00117 * 00118 IF( UPPER ) THEN 00119 * 00120 * Compute the Cholesky factorization A = U**H *U. 00121 * 00122 DO 10 J = 1, N, NB 00123 * 00124 * Update and factorize the current diagonal block and test 00125 * for non-positive-definiteness. 00126 * 00127 JB = MIN( NB, N-J+1 ) 00128 CALL ZHERK( 'Upper', 'Conjugate transpose', JB, J-1, 00129 $ -ONE, A( 1, J ), LDA, ONE, A( J, J ), LDA ) 00130 CALL ZPOTF2( 'Upper', JB, A( J, J ), LDA, INFO ) 00131 IF( INFO.NE.0 ) 00132 $ GO TO 30 00133 IF( J+JB.LE.N ) THEN 00134 * 00135 * Compute the current block row. 00136 * 00137 CALL ZGEMM( 'Conjugate transpose', 'No transpose', JB, 00138 $ N-J-JB+1, J-1, -CONE, A( 1, J ), LDA, 00139 $ A( 1, J+JB ), LDA, CONE, A( J, J+JB ), 00140 $ LDA ) 00141 CALL ZTRSM( 'Left', 'Upper', 'Conjugate transpose', 00142 $ 'Non-unit', JB, N-J-JB+1, CONE, A( J, J ), 00143 $ LDA, A( J, J+JB ), LDA ) 00144 END IF 00145 10 CONTINUE 00146 * 00147 ELSE 00148 * 00149 * Compute the Cholesky factorization A = L*L**H. 00150 * 00151 DO 20 J = 1, N, NB 00152 * 00153 * Update and factorize the current diagonal block and test 00154 * for non-positive-definiteness. 00155 * 00156 JB = MIN( NB, N-J+1 ) 00157 CALL ZHERK( 'Lower', 'No transpose', JB, J-1, -ONE, 00158 $ A( J, 1 ), LDA, ONE, A( J, J ), LDA ) 00159 CALL ZPOTF2( 'Lower', JB, A( J, J ), LDA, INFO ) 00160 IF( INFO.NE.0 ) 00161 $ GO TO 30 00162 IF( J+JB.LE.N ) THEN 00163 * 00164 * Compute the current block column. 00165 * 00166 CALL ZGEMM( 'No transpose', 'Conjugate transpose', 00167 $ N-J-JB+1, JB, J-1, -CONE, A( J+JB, 1 ), 00168 $ LDA, A( J, 1 ), LDA, CONE, A( J+JB, J ), 00169 $ LDA ) 00170 CALL ZTRSM( 'Right', 'Lower', 'Conjugate transpose', 00171 $ 'Non-unit', N-J-JB+1, JB, CONE, A( J, J ), 00172 $ LDA, A( J+JB, J ), LDA ) 00173 END IF 00174 20 CONTINUE 00175 END IF 00176 END IF 00177 GO TO 40 00178 * 00179 30 CONTINUE 00180 INFO = INFO + J - 1 00181 * 00182 40 CONTINUE 00183 RETURN 00184 * 00185 * End of ZPOTRF 00186 * 00187 END