139 COMPLEX A( LDA, * ), WORK( * )
147 parameter( one = 1.0e+0, cone = ( 1.0e+0, 0.0e+0 ),
148 $ czero = ( 0.0e+0, 0.0e+0 ) )
152 INTEGER J, K, KP, KSTEP
159 EXTERNAL lsame, cdotc
165 INTRINSIC abs, conjg, max, real
172 upper = lsame( uplo,
'U' )
173 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
175 ELSE IF( n.LT.0 )
THEN
177 ELSE IF( lda.LT.max( 1, n ) )
THEN
181 CALL xerbla(
'CHETRI_ROOK', -info )
196 DO 10 info = n, 1, -1
197 IF( ipiv( info ).GT.0 .AND. a( info, info ).EQ.czero )
205 IF( ipiv( info ).GT.0 .AND. a( info, info ).EQ.czero )
226 IF( ipiv( k ).GT.0 )
THEN
232 a( k, k ) = one / real( a( k, k ) )
237 CALL ccopy( k-1, a( 1, k ), 1, work, 1 )
238 CALL chemv( uplo, k-1, -cone, a, lda, work, 1, czero,
240 a( k, k ) = a( k, k ) - real( cdotc( k-1, work, 1, a( 1,
250 t = abs( a( k, k+1 ) )
251 ak = real( a( k, k ) ) / t
252 akp1 = real( a( k+1, k+1 ) ) / t
253 akkp1 = a( k, k+1 ) / t
254 d = t*( ak*akp1-one )
256 a( k+1, k+1 ) = ak / d
257 a( k, k+1 ) = -akkp1 / d
262 CALL ccopy( k-1, a( 1, k ), 1, work, 1 )
263 CALL chemv( uplo, k-1, -cone, a, lda, work, 1, czero,
265 a( k, k ) = a( k, k ) - real( cdotc( k-1, work, 1, a( 1,
267 a( k, k+1 ) = a( k, k+1 ) -
268 $ cdotc( k-1, a( 1, k ), 1, a( 1, k+1 ), 1 )
269 CALL ccopy( k-1, a( 1, k+1 ), 1, work, 1 )
270 CALL chemv( uplo, k-1, -cone, a, lda, work, 1, czero,
272 a( k+1, k+1 ) = a( k+1, k+1 ) -
273 $ real( cdotc( k-1, work, 1, a( 1, k+1 ),
279 IF( kstep.EQ.1 )
THEN
288 $
CALL cswap( kp-1, a( 1, k ), 1, a( 1, kp ), 1 )
290 DO 40 j = kp + 1, k - 1
291 temp = conjg( a( j, k ) )
292 a( j, k ) = conjg( a( kp, j ) )
296 a( kp, k ) = conjg( a( kp, k ) )
299 a( k, k ) = a( kp, kp )
313 $
CALL cswap( kp-1, a( 1, k ), 1, a( 1, kp ), 1 )
315 DO 50 j = kp + 1, k - 1
316 temp = conjg( a( j, k ) )
317 a( j, k ) = conjg( a( kp, j ) )
321 a( kp, k ) = conjg( a( kp, k ) )
324 a( k, k ) = a( kp, kp )
328 a( k, k+1 ) = a( kp, k+1 )
339 $
CALL cswap( kp-1, a( 1, k ), 1, a( 1, kp ), 1 )
341 DO 60 j = kp + 1, k - 1
342 temp = conjg( a( j, k ) )
343 a( j, k ) = conjg( a( kp, j ) )
347 a( kp, k ) = conjg( a( kp, k ) )
350 a( k, k ) = a( kp, kp )
374 IF( ipiv( k ).GT.0 )
THEN
380 a( k, k ) = one / real( a( k, k ) )
385 CALL ccopy( n-k, a( k+1, k ), 1, work, 1 )
386 CALL chemv( uplo, n-k, -cone, a( k+1, k+1 ), lda, work,
387 $ 1, czero, a( k+1, k ), 1 )
388 a( k, k ) = a( k, k ) - real( cdotc( n-k, work, 1,
398 t = abs( a( k, k-1 ) )
399 ak = real( a( k-1, k-1 ) ) / t
400 akp1 = real( a( k, k ) ) / t
401 akkp1 = a( k, k-1 ) / t
402 d = t*( ak*akp1-one )
403 a( k-1, k-1 ) = akp1 / d
405 a( k, k-1 ) = -akkp1 / d
410 CALL ccopy( n-k, a( k+1, k ), 1, work, 1 )
411 CALL chemv( uplo, n-k, -cone, a( k+1, k+1 ), lda, work,
412 $ 1, czero, a( k+1, k ), 1 )
413 a( k, k ) = a( k, k ) - real( cdotc( n-k, work, 1,
415 a( k, k-1 ) = a( k, k-1 ) -
416 $ cdotc( n-k, a( k+1, k ), 1, a( k+1, k-1 ),
418 CALL ccopy( n-k, a( k+1, k-1 ), 1, work, 1 )
419 CALL chemv( uplo, n-k, -cone, a( k+1, k+1 ), lda, work,
420 $ 1, czero, a( k+1, k-1 ), 1 )
421 a( k-1, k-1 ) = a( k-1, k-1 ) -
422 $ real( cdotc( n-k, work, 1, a( k+1, k-1 ),
428 IF( kstep.EQ.1 )
THEN
437 $
CALL cswap( n-kp, a( kp+1, k ), 1, a( kp+1, kp ), 1 )
439 DO 90 j = k + 1, kp - 1
440 temp = conjg( a( j, k ) )
441 a( j, k ) = conjg( a( kp, j ) )
445 a( kp, k ) = conjg( a( kp, k ) )
448 a( k, k ) = a( kp, kp )
462 $
CALL cswap( n-kp, a( kp+1, k ), 1, a( kp+1, kp ), 1 )
464 DO 100 j = k + 1, kp - 1
465 temp = conjg( a( j, k ) )
466 a( j, k ) = conjg( a( kp, j ) )
470 a( kp, k ) = conjg( a( kp, k ) )
473 a( k, k ) = a( kp, kp )
477 a( k, k-1 ) = a( kp, k-1 )
488 $
CALL cswap( n-kp, a( kp+1, k ), 1, a( kp+1, kp ), 1 )
490 DO 110 j = k + 1, kp - 1
491 temp = conjg( a( j, k ) )
492 a( j, k ) = conjg( a( kp, j ) )
496 a( kp, k ) = conjg( a( kp, k ) )
499 a( k, k ) = a( kp, kp )
subroutine xerbla(srname, info)
subroutine ccopy(n, cx, incx, cy, incy)
CCOPY
subroutine chemv(uplo, n, alpha, a, lda, x, incx, beta, y, incy)
CHEMV
subroutine chetri_rook(uplo, n, a, lda, ipiv, work, info)
CHETRI_ROOK computes the inverse of HE matrix using the factorization obtained with the bounded Bunch...
subroutine cswap(n, cx, incx, cy, incy)
CSWAP