130
131
132
133
134
135
136 CHARACTER UPLO
137 LOGICAL CAPPLY
138 INTEGER N, LDA, LDAF, INFO
139
140
141 COMPLEX A( LDA, * ), AF( LDAF, * ), WORK( * )
142 REAL C( * ), RWORK( * )
143
144
145
146
147
148 INTEGER KASE
149 REAL AINVNM, ANORM, TMP
150 INTEGER I, J
151 LOGICAL UP, UPPER
152 COMPLEX ZDUM
153
154
155 INTEGER ISAVE( 3 )
156
157
158 LOGICAL LSAME
160
161
163
164
165 INTRINSIC abs, max, real, aimag
166
167
168 REAL CABS1
169
170
171 cabs1( zdum ) = abs( real( zdum ) ) + abs( aimag( zdum ) )
172
173
174
176
177 info = 0
178 upper =
lsame( uplo,
'U' )
179 IF( .NOT.upper .AND. .NOT.
lsame( uplo,
'L' ) )
THEN
180 info = -1
181 ELSE IF( n.LT.0 ) THEN
182 info = -2
183 ELSE IF( lda.LT.max( 1, n ) ) THEN
184 info = -4
185 ELSE IF( ldaf.LT.max( 1, n ) ) THEN
186 info = -6
187 END IF
188 IF( info.NE.0 ) THEN
189 CALL xerbla(
'CLA_PORCOND_C', -info )
190 RETURN
191 END IF
192 up = .false.
193 IF (
lsame( uplo,
'U' ) ) up = .true.
194
195
196
197 anorm = 0.0e+0
198 IF ( up ) THEN
199 DO i = 1, n
200 tmp = 0.0e+0
201 IF ( capply ) THEN
202 DO j = 1, i
203 tmp = tmp + cabs1( a( j, i ) ) / c( j )
204 END DO
205 DO j = i+1, n
206 tmp = tmp + cabs1( a( i, j ) ) / c( j )
207 END DO
208 ELSE
209 DO j = 1, i
210 tmp = tmp + cabs1( a( j, i ) )
211 END DO
212 DO j = i+1, n
213 tmp = tmp + cabs1( a( i, j ) )
214 END DO
215 END IF
216 rwork( i ) = tmp
217 anorm = max( anorm, tmp )
218 END DO
219 ELSE
220 DO i = 1, n
221 tmp = 0.0e+0
222 IF ( capply ) THEN
223 DO j = 1, i
224 tmp = tmp + cabs1( a( i, j ) ) / c( j )
225 END DO
226 DO j = i+1, n
227 tmp = tmp + cabs1( a( j, i ) ) / c( j )
228 END DO
229 ELSE
230 DO j = 1, i
231 tmp = tmp + cabs1( a( i, j ) )
232 END DO
233 DO j = i+1, n
234 tmp = tmp + cabs1( a( j, i ) )
235 END DO
236 END IF
237 rwork( i ) = tmp
238 anorm = max( anorm, tmp )
239 END DO
240 END IF
241
242
243
244 IF( n.EQ.0 ) THEN
246 RETURN
247 ELSE IF( anorm .EQ. 0.0e+0 ) THEN
248 RETURN
249 END IF
250
251
252
253 ainvnm = 0.0e+0
254
255 kase = 0
256 10 CONTINUE
257 CALL clacn2( n, work( n+1 ), work, ainvnm, kase, isave )
258 IF( kase.NE.0 ) THEN
259 IF( kase.EQ.2 ) THEN
260
261
262
263 DO i = 1, n
264 work( i ) = work( i ) * rwork( i )
265 END DO
266
267 IF ( up ) THEN
268 CALL cpotrs(
'U', n, 1, af, ldaf,
269 $ work, n, info )
270 ELSE
271 CALL cpotrs(
'L', n, 1, af, ldaf,
272 $ work, n, info )
273 ENDIF
274
275
276
277 IF ( capply ) THEN
278 DO i = 1, n
279 work( i ) = work( i ) * c( i )
280 END DO
281 END IF
282 ELSE
283
284
285
286 IF ( capply ) THEN
287 DO i = 1, n
288 work( i ) = work( i ) * c( i )
289 END DO
290 END IF
291
292 IF ( up ) THEN
293 CALL cpotrs(
'U', n, 1, af, ldaf,
294 $ work, n, info )
295 ELSE
296 CALL cpotrs(
'L', n, 1, af, ldaf,
297 $ work, n, info )
298 END IF
299
300
301
302 DO i = 1, n
303 work( i ) = work( i ) * rwork( i )
304 END DO
305 END IF
306 GO TO 10
307 END IF
308
309
310
311 IF( ainvnm .NE. 0.0e+0 )
313
314 RETURN
315
316
317
subroutine xerbla(srname, info)
real function cla_porcond_c(uplo, n, a, lda, af, ldaf, c, capply, info, work, rwork)
CLA_PORCOND_C computes the infinity norm condition number of op(A)*inv(diag(c)) for Hermitian positiv...
subroutine clacn2(n, v, x, est, kase, isave)
CLACN2 estimates the 1-norm of a square matrix, using reverse communication for evaluating matrix-vec...
logical function lsame(ca, cb)
LSAME
subroutine cpotrs(uplo, n, nrhs, a, lda, b, ldb, info)
CPOTRS