212 parameter( zero = 0.0e+0, one = 1.0e+0 )
214 parameter( eight = 8.0e+0, sevten = 17.0e+0 )
218 INTEGER I, II, IMAX, ITEMP, J, JMAX, K, KK, KP, KSTEP,
220 REAL ABSAKK, ALPHA, COLMAX, D, D11, D22, R1, STEMP,
222 COMPLEX D12, D21, T, WK, WKM1, WKP1, Z
229 EXTERNAL lsame, icamax, slamch, slapy2
235 INTRINSIC abs, aimag, cmplx, conjg, max, real, sqrt
241 cabs1( z ) = abs( real( z ) ) + abs( aimag( z ) )
248 upper = lsame( uplo,
'U' )
249 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
251 ELSE IF( n.LT.0 )
THEN
253 ELSE IF( lda.LT.max( 1, n ) )
THEN
257 CALL xerbla(
'CHETF2_ROOK', -info )
263 alpha = ( one+sqrt( sevten ) ) / eight
267 sfmin = slamch(
'S' )
289 absakk = abs( real( a( k, k ) ) )
296 imax = icamax( k-1, a( 1, k ), 1 )
297 colmax = cabs1( a( imax, k ) )
302 IF( ( max( absakk, colmax ).EQ.zero ) )
THEN
309 a( k, k ) = real( a( k, k ) )
320 IF( .NOT.( absakk.LT.alpha*colmax ) )
THEN
342 jmax = imax + icamax( k-imax, a( imax, imax+1 ),
344 rowmax = cabs1( a( imax, jmax ) )
350 itemp = icamax( imax-1, a( 1, imax ), 1 )
351 stemp = cabs1( a( itemp, imax ) )
352 IF( stemp.GT.rowmax )
THEN
363 IF( .NOT.( abs( real( a( imax, imax ) ) )
364 $ .LT.alpha*rowmax ) )
THEN
376 ELSE IF( ( p.EQ.jmax ) .OR. ( rowmax.LE.colmax ) )
398 IF( .NOT.done )
GOTO 12
413 IF( ( kstep.EQ.2 ) .AND. ( p.NE.k ) )
THEN
416 $
CALL cswap( p-1, a( 1, k ), 1, a( 1, p ), 1 )
418 DO 14 j = p + 1, k - 1
419 t = conjg( a( j, k ) )
420 a( j, k ) = conjg( a( p, j ) )
424 a( p, k ) = conjg( a( p, k ) )
426 r1 = real( a( k, k ) )
427 a( k, k ) = real( a( p, p ) )
437 $
CALL cswap( kp-1, a( 1, kk ), 1, a( 1, kp ), 1 )
439 DO 15 j = kp + 1, kk - 1
440 t = conjg( a( j, kk ) )
441 a( j, kk ) = conjg( a( kp, j ) )
445 a( kp, kk ) = conjg( a( kp, kk ) )
447 r1 = real( a( kk, kk ) )
448 a( kk, kk ) = real( a( kp, kp ) )
451 IF( kstep.EQ.2 )
THEN
453 a( k, k ) = real( a( k, k ) )
456 a( k-1, k ) = a( kp, k )
461 a( k, k ) = real( a( k, k ) )
463 $ a( k-1, k-1 ) = real( a( k-1, k-1 ) )
468 IF( kstep.EQ.1 )
THEN
481 IF( abs( real( a( k, k ) ) ).GE.sfmin )
THEN
487 d11 = one / real( a( k, k ) )
488 CALL cher( uplo, k-1, -d11, a( 1, k ), 1, a, lda )
492 CALL csscal( k-1, d11, a( 1, k ), 1 )
497 d11 = real( a( k, k ) )
499 a( ii, k ) = a( ii, k ) / d11
507 CALL cher( uplo, k-1, -d11, a( 1, k ), 1, a, lda )
529 d = slapy2( real( a( k-1, k ) ),
530 $ aimag( a( k-1, k ) ) )
531 d11 = real( a( k, k ) / d )
532 d22 = real( a( k-1, k-1 ) / d )
533 d12 = a( k-1, k ) / d
534 tt = one / ( d11*d22-one )
536 DO 30 j = k - 2, 1, -1
540 wkm1 = tt*( d11*a( j, k-1 )-conjg( d12 )*
542 wk = tt*( d22*a( j, k )-d12*a( j, k-1 ) )
547 a( i, j ) = a( i, j ) -
548 $ ( a( i, k ) / d )*conjg( wk ) -
549 $ ( a( i, k-1 ) / d )*conjg( wkm1 )
555 a( j, k-1 ) = wkm1 / d
557 a( j, j ) = cmplx( real( a( j, j ) ), zero )
569 IF( kstep.EQ.1 )
THEN
601 absakk = abs( real( a( k, k ) ) )
608 imax = k + icamax( n-k, a( k+1, k ), 1 )
609 colmax = cabs1( a( imax, k ) )
614 IF( max( absakk, colmax ).EQ.zero )
THEN
621 a( k, k ) = real( a( k, k ) )
632 IF( .NOT.( absakk.LT.alpha*colmax ) )
THEN
654 jmax = k - 1 + icamax( imax-k, a( imax, k ), lda )
655 rowmax = cabs1( a( imax, jmax ) )
661 itemp = imax + icamax( n-imax, a( imax+1, imax ),
663 stemp = cabs1( a( itemp, imax ) )
664 IF( stemp.GT.rowmax )
THEN
675 IF( .NOT.( abs( real( a( imax, imax ) ) )
676 $ .LT.alpha*rowmax ) )
THEN
688 ELSE IF( ( p.EQ.jmax ) .OR. ( rowmax.LE.colmax ) )
711 IF( .NOT.done )
GOTO 42
726 IF( ( kstep.EQ.2 ) .AND. ( p.NE.k ) )
THEN
729 $
CALL cswap( n-p, a( p+1, k ), 1, a( p+1, p ), 1 )
731 DO 44 j = k + 1, p - 1
732 t = conjg( a( j, k ) )
733 a( j, k ) = conjg( a( p, j ) )
737 a( p, k ) = conjg( a( p, k ) )
739 r1 = real( a( k, k ) )
740 a( k, k ) = real( a( p, p ) )
750 $
CALL cswap( n-kp, a( kp+1, kk ), 1, a( kp+1, kp ), 1 )
752 DO 45 j = kk + 1, kp - 1
753 t = conjg( a( j, kk ) )
754 a( j, kk ) = conjg( a( kp, j ) )
758 a( kp, kk ) = conjg( a( kp, kk ) )
760 r1 = real( a( kk, kk ) )
761 a( kk, kk ) = real( a( kp, kp ) )
764 IF( kstep.EQ.2 )
THEN
766 a( k, k ) = real( a( k, k ) )
769 a( k+1, k ) = a( kp, k )
774 a( k, k ) = real( a( k, k ) )
776 $ a( k+1, k+1 ) = real( a( k+1, k+1 ) )
781 IF( kstep.EQ.1 )
THEN
796 IF( abs( real( a( k, k ) ) ).GE.sfmin )
THEN
802 d11 = one / real( a( k, k ) )
803 CALL cher( uplo, n-k, -d11, a( k+1, k ), 1,
804 $ a( k+1, k+1 ), lda )
808 CALL csscal( n-k, d11, a( k+1, k ), 1 )
813 d11 = real( a( k, k ) )
815 a( ii, k ) = a( ii, k ) / d11
823 CALL cher( uplo, n-k, -d11, a( k+1, k ), 1,
824 $ a( k+1, k+1 ), lda )
847 d = slapy2( real( a( k+1, k ) ),
848 $ aimag( a( k+1, k ) ) )
849 d11 = real( a( k+1, k+1 ) ) / d
850 d22 = real( a( k, k ) ) / d
851 d21 = a( k+1, k ) / d
852 tt = one / ( d11*d22-one )
858 wk = tt*( d11*a( j, k )-d21*a( j, k+1 ) )
859 wkp1 = tt*( d22*a( j, k+1 )-conjg( d21 )*
865 a( i, j ) = a( i, j ) -
866 $ ( a( i, k ) / d )*conjg( wk ) -
867 $ ( a( i, k+1 ) / d )*conjg( wkp1 )
873 a( j, k+1 ) = wkp1 / d
875 a( j, j ) = cmplx( real( a( j, j ) ), zero )
887 IF( kstep.EQ.1 )
THEN
subroutine xerbla(srname, info)
subroutine cher(uplo, n, alpha, x, incx, a, lda)
CHER
subroutine chetf2_rook(uplo, n, a, lda, ipiv, info)
CHETF2_ROOK computes the factorization of a complex Hermitian indefinite matrix using the bounded Bun...
subroutine csscal(n, sa, cx, incx)
CSSCAL
subroutine cswap(n, cx, incx, cy, incy)
CSWAP