137 COMPLEX A( LDA, * ), WORK( * )
145 parameter( one = 1.0e+0, cone = ( 1.0e+0, 0.0e+0 ),
146 $ czero = ( 0.0e+0, 0.0e+0 ) )
150 INTEGER J, K, KP, KSTEP
157 EXTERNAL lsame, cdotc
163 INTRINSIC abs, conjg, max, real
170 upper = lsame( uplo,
'U' )
171 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
173 ELSE IF( n.LT.0 )
THEN
175 ELSE IF( lda.LT.max( 1, n ) )
THEN
179 CALL xerbla(
'CHETRI_ROOK', -info )
194 DO 10 info = n, 1, -1
195 IF( ipiv( info ).GT.0 .AND. a( info, info ).EQ.czero )
203 IF( ipiv( info ).GT.0 .AND. a( info, info ).EQ.czero )
224 IF( ipiv( k ).GT.0 )
THEN
230 a( k, k ) = one / real( a( k, k ) )
235 CALL ccopy( k-1, a( 1, k ), 1, work, 1 )
236 CALL chemv( uplo, k-1, -cone, a, lda, work, 1, czero,
238 a( k, k ) = a( k, k ) - real( cdotc( k-1, work, 1,
249 t = abs( a( k, k+1 ) )
250 ak = real( a( k, k ) ) / t
251 akp1 = real( a( k+1, k+1 ) ) / t
252 akkp1 = a( k, k+1 ) / t
253 d = t*( ak*akp1-one )
255 a( k+1, k+1 ) = ak / d
256 a( k, k+1 ) = -akkp1 / d
261 CALL ccopy( k-1, a( 1, k ), 1, work, 1 )
262 CALL chemv( uplo, k-1, -cone, a, lda, work, 1, czero,
264 a( k, k ) = a( k, k ) - real( cdotc( k-1, work, 1,
267 a( k, k+1 ) = a( k, k+1 ) -
268 $ cdotc( k-1, a( 1, k ), 1, a( 1, k+1 ),
270 CALL ccopy( k-1, a( 1, k+1 ), 1, work, 1 )
271 CALL chemv( uplo, k-1, -cone, a, lda, work, 1, czero,
273 a( k+1, k+1 ) = a( k+1, k+1 ) -
274 $ real( cdotc( k-1, work, 1, a( 1,
281 IF( kstep.EQ.1 )
THEN
290 $
CALL cswap( kp-1, a( 1, k ), 1, a( 1, kp ), 1 )
292 DO 40 j = kp + 1, k - 1
293 temp = conjg( a( j, k ) )
294 a( j, k ) = conjg( a( kp, j ) )
298 a( kp, k ) = conjg( a( kp, k ) )
301 a( k, k ) = a( kp, kp )
315 $
CALL cswap( kp-1, a( 1, k ), 1, a( 1, kp ), 1 )
317 DO 50 j = kp + 1, k - 1
318 temp = conjg( a( j, k ) )
319 a( j, k ) = conjg( a( kp, j ) )
323 a( kp, k ) = conjg( a( kp, k ) )
326 a( k, k ) = a( kp, kp )
330 a( k, k+1 ) = a( kp, k+1 )
341 $
CALL cswap( kp-1, a( 1, k ), 1, a( 1, kp ), 1 )
343 DO 60 j = kp + 1, k - 1
344 temp = conjg( a( j, k ) )
345 a( j, k ) = conjg( a( kp, j ) )
349 a( kp, k ) = conjg( a( kp, k ) )
352 a( k, k ) = a( kp, kp )
376 IF( ipiv( k ).GT.0 )
THEN
382 a( k, k ) = one / real( a( k, k ) )
387 CALL ccopy( n-k, a( k+1, k ), 1, work, 1 )
388 CALL chemv( uplo, n-k, -cone, a( k+1, k+1 ), lda,
390 $ 1, czero, a( k+1, k ), 1 )
391 a( k, k ) = a( k, k ) - real( cdotc( n-k, work, 1,
401 t = abs( a( k, k-1 ) )
402 ak = real( a( k-1, k-1 ) ) / t
403 akp1 = real( a( k, k ) ) / t
404 akkp1 = a( k, k-1 ) / t
405 d = t*( ak*akp1-one )
406 a( k-1, k-1 ) = akp1 / d
408 a( k, k-1 ) = -akkp1 / d
413 CALL ccopy( n-k, a( k+1, k ), 1, work, 1 )
414 CALL chemv( uplo, n-k, -cone, a( k+1, k+1 ), lda,
416 $ 1, czero, a( k+1, k ), 1 )
417 a( k, k ) = a( k, k ) - real( cdotc( n-k, work, 1,
419 a( k, k-1 ) = a( k, k-1 ) -
420 $ cdotc( n-k, a( k+1, k ), 1, a( k+1,
423 CALL ccopy( n-k, a( k+1, k-1 ), 1, work, 1 )
424 CALL chemv( uplo, n-k, -cone, a( k+1, k+1 ), lda,
426 $ 1, czero, a( k+1, k-1 ), 1 )
427 a( k-1, k-1 ) = a( k-1, k-1 ) -
428 $ real( cdotc( n-k, work, 1, a( k+1,
435 IF( kstep.EQ.1 )
THEN
444 $
CALL cswap( n-kp, a( kp+1, k ), 1, a( kp+1, kp ),
447 DO 90 j = k + 1, kp - 1
448 temp = conjg( a( j, k ) )
449 a( j, k ) = conjg( a( kp, j ) )
453 a( kp, k ) = conjg( a( kp, k ) )
456 a( k, k ) = a( kp, kp )
470 $
CALL cswap( n-kp, a( kp+1, k ), 1, a( kp+1, kp ),
473 DO 100 j = k + 1, kp - 1
474 temp = conjg( a( j, k ) )
475 a( j, k ) = conjg( a( kp, j ) )
479 a( kp, k ) = conjg( a( kp, k ) )
482 a( k, k ) = a( kp, kp )
486 a( k, k-1 ) = a( kp, k-1 )
497 $
CALL cswap( n-kp, a( kp+1, k ), 1, a( kp+1, kp ),
500 DO 110 j = k + 1, kp - 1
501 temp = conjg( a( j, k ) )
502 a( j, k ) = conjg( a( kp, j ) )
506 a( kp, k ) = conjg( a( kp, k ) )
509 a( k, k ) = a( kp, kp )