LAPACK 3.3.1
Linear Algebra PACKage
|
00001 REAL FUNCTION CLA_PORCOND_X( UPLO, N, A, LDA, AF, LDAF, X, INFO, 00002 $ WORK, RWORK ) 00003 * 00004 * -- LAPACK routine (version 3.2.1) -- 00005 * -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and -- 00006 * -- Jason Riedy of Univ. of California Berkeley. -- 00007 * -- April 2009 -- 00008 * 00009 * -- LAPACK is a software package provided by Univ. of Tennessee, -- 00010 * -- Univ. of California Berkeley and NAG Ltd. -- 00011 * 00012 IMPLICIT NONE 00013 * .. 00014 * .. Scalar Arguments .. 00015 CHARACTER UPLO 00016 INTEGER N, LDA, LDAF, INFO 00017 * .. 00018 * .. Array Arguments .. 00019 COMPLEX A( LDA, * ), AF( LDAF, * ), WORK( * ), X( * ) 00020 REAL RWORK( * ) 00021 * .. 00022 * 00023 * Purpose 00024 * ======= 00025 * 00026 * CLA_PORCOND_X Computes the infinity norm condition number of 00027 * op(A) * diag(X) where X is a COMPLEX vector. 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 number of linear equations, i.e., the order of the 00038 * matrix A. N >= 0. 00039 * 00040 * A (input) COMPLEX array, dimension (LDA,N) 00041 * On entry, the N-by-N matrix A. 00042 * 00043 * LDA (input) INTEGER 00044 * The leading dimension of the array A. LDA >= max(1,N). 00045 * 00046 * AF (input) COMPLEX array, dimension (LDAF,N) 00047 * The triangular factor U or L from the Cholesky factorization 00048 * A = U**T*U or A = L*L**T, as computed by CPOTRF. 00049 * 00050 * LDAF (input) INTEGER 00051 * The leading dimension of the array AF. LDAF >= max(1,N). 00052 * 00053 * X (input) COMPLEX array, dimension (N) 00054 * The vector X in the formula op(A) * diag(X). 00055 * 00056 * INFO (output) INTEGER 00057 * = 0: Successful exit. 00058 * i > 0: The ith argument is invalid. 00059 * 00060 * WORK (input) COMPLEX array, dimension (2*N). 00061 * Workspace. 00062 * 00063 * RWORK (input) REAL array, dimension (N). 00064 * Workspace. 00065 * 00066 * ===================================================================== 00067 * 00068 * .. Local Scalars .. 00069 INTEGER KASE, I, J 00070 REAL AINVNM, ANORM, TMP 00071 LOGICAL UP 00072 COMPLEX ZDUM 00073 * .. 00074 * .. Local Arrays .. 00075 INTEGER ISAVE( 3 ) 00076 * .. 00077 * .. External Functions .. 00078 LOGICAL LSAME 00079 EXTERNAL LSAME 00080 * .. 00081 * .. External Subroutines .. 00082 EXTERNAL CLACN2, CPOTRS, XERBLA 00083 * .. 00084 * .. Intrinsic Functions .. 00085 INTRINSIC ABS, MAX, REAL, AIMAG 00086 * .. 00087 * .. Statement Functions .. 00088 REAL CABS1 00089 * .. 00090 * .. Statement Function Definitions .. 00091 CABS1( ZDUM ) = ABS( REAL( ZDUM ) ) + ABS( AIMAG( ZDUM ) ) 00092 * .. 00093 * .. Executable Statements .. 00094 * 00095 CLA_PORCOND_X = 0.0E+0 00096 * 00097 INFO = 0 00098 IF( N.LT.0 ) THEN 00099 INFO = -2 00100 END IF 00101 IF( INFO.NE.0 ) THEN 00102 CALL XERBLA( 'CLA_PORCOND_X', -INFO ) 00103 RETURN 00104 END IF 00105 UP = .FALSE. 00106 IF ( LSAME( UPLO, 'U' ) ) UP = .TRUE. 00107 * 00108 * Compute norm of op(A)*op2(C). 00109 * 00110 ANORM = 0.0 00111 IF ( UP ) THEN 00112 DO I = 1, N 00113 TMP = 0.0E+0 00114 DO J = 1, I 00115 TMP = TMP + CABS1( A( J, I ) * X( J ) ) 00116 END DO 00117 DO J = I+1, N 00118 TMP = TMP + CABS1( A( I, J ) * X( J ) ) 00119 END DO 00120 RWORK( I ) = TMP 00121 ANORM = MAX( ANORM, TMP ) 00122 END DO 00123 ELSE 00124 DO I = 1, N 00125 TMP = 0.0E+0 00126 DO J = 1, I 00127 TMP = TMP + CABS1( A( I, J ) * X( J ) ) 00128 END DO 00129 DO J = I+1, N 00130 TMP = TMP + CABS1( A( J, I ) * X( J ) ) 00131 END DO 00132 RWORK( I ) = TMP 00133 ANORM = MAX( ANORM, TMP ) 00134 END DO 00135 END IF 00136 * 00137 * Quick return if possible. 00138 * 00139 IF( N.EQ.0 ) THEN 00140 CLA_PORCOND_X = 1.0E+0 00141 RETURN 00142 ELSE IF( ANORM .EQ. 0.0E+0 ) THEN 00143 RETURN 00144 END IF 00145 * 00146 * Estimate the norm of inv(op(A)). 00147 * 00148 AINVNM = 0.0E+0 00149 * 00150 KASE = 0 00151 10 CONTINUE 00152 CALL CLACN2( N, WORK( N+1 ), WORK, AINVNM, KASE, ISAVE ) 00153 IF( KASE.NE.0 ) THEN 00154 IF( KASE.EQ.2 ) THEN 00155 * 00156 * Multiply by R. 00157 * 00158 DO I = 1, N 00159 WORK( I ) = WORK( I ) * RWORK( I ) 00160 END DO 00161 * 00162 IF ( UP ) THEN 00163 CALL CPOTRS( 'U', N, 1, AF, LDAF, 00164 $ WORK, N, INFO ) 00165 ELSE 00166 CALL CPOTRS( 'L', N, 1, AF, LDAF, 00167 $ WORK, N, INFO ) 00168 ENDIF 00169 * 00170 * Multiply by inv(X). 00171 * 00172 DO I = 1, N 00173 WORK( I ) = WORK( I ) / X( I ) 00174 END DO 00175 ELSE 00176 * 00177 * Multiply by inv(X**H). 00178 * 00179 DO I = 1, N 00180 WORK( I ) = WORK( I ) / X( I ) 00181 END DO 00182 * 00183 IF ( UP ) THEN 00184 CALL CPOTRS( 'U', N, 1, AF, LDAF, 00185 $ WORK, N, INFO ) 00186 ELSE 00187 CALL CPOTRS( 'L', N, 1, AF, LDAF, 00188 $ WORK, N, INFO ) 00189 END IF 00190 * 00191 * Multiply by R. 00192 * 00193 DO I = 1, N 00194 WORK( I ) = WORK( I ) * RWORK( I ) 00195 END DO 00196 END IF 00197 GO TO 10 00198 END IF 00199 * 00200 * Compute the estimate of the reciprocal condition number. 00201 * 00202 IF( AINVNM .NE. 0.0E+0 ) 00203 $ CLA_PORCOND_X = 1.0E+0 / AINVNM 00204 * 00205 RETURN 00206 * 00207 END