252 COMPLEX*16 A( LDA, * ), E( * )
258 DOUBLE PRECISION ZERO, ONE
259 parameter( zero = 0.0d+0, one = 1.0d+0 )
260 DOUBLE PRECISION EIGHT, SEVTEN
261 parameter( eight = 8.0d+0, sevten = 17.0d+0 )
263 parameter( czero = ( 0.0d+0, 0.0d+0 ) )
267 INTEGER I, II, IMAX, ITEMP, J, JMAX, K, KK, KP, KSTEP,
269 DOUBLE PRECISION ABSAKK, ALPHA, COLMAX, D, D11, D22, R1, DTEMP,
271 COMPLEX*16 D12, D21, T, WK, WKM1, WKP1, Z
277 DOUBLE PRECISION DLAMCH, DLAPY2
278 EXTERNAL lsame, izamax, dlamch, dlapy2
284 INTRINSIC abs, dble, dcmplx, dconjg, dimag, max, sqrt
287 DOUBLE PRECISION CABS1
290 cabs1( z ) = abs( dble( z ) ) + abs( dimag( z ) )
297 upper = lsame( uplo,
'U' )
298 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
300 ELSE IF( n.LT.0 )
THEN
302 ELSE IF( lda.LT.max( 1, n ) )
THEN
306 CALL xerbla(
'ZHETF2_RK', -info )
312 alpha = ( one+sqrt( sevten ) ) / eight
316 sfmin = dlamch(
'S' )
343 absakk = abs( dble( a( k, k ) ) )
350 imax = izamax( k-1, a( 1, k ), 1 )
351 colmax = cabs1( a( imax, k ) )
356 IF( ( max( absakk, colmax ).EQ.zero ) )
THEN
363 a( k, k ) = dble( a( k, k ) )
380 IF( .NOT.( absakk.LT.alpha*colmax ) )
THEN
402 jmax = imax + izamax( k-imax, a( imax, imax+1 ),
404 rowmax = cabs1( a( imax, jmax ) )
410 itemp = izamax( imax-1, a( 1, imax ), 1 )
411 dtemp = cabs1( a( itemp, imax ) )
412 IF( dtemp.GT.rowmax )
THEN
423 IF( .NOT.( abs( dble( a( imax, imax ) ) )
424 $ .LT.alpha*rowmax ) )
THEN
436 ELSE IF( ( p.EQ.jmax ) .OR. ( rowmax.LE.colmax ) )
458 IF( .NOT.done )
GOTO 12
473 IF( ( kstep.EQ.2 ) .AND. ( p.NE.k ) )
THEN
476 $
CALL zswap( p-1, a( 1, k ), 1, a( 1, p ), 1 )
478 DO 14 j = p + 1, k - 1
479 t = dconjg( a( j, k ) )
480 a( j, k ) = dconjg( a( p, j ) )
484 a( p, k ) = dconjg( a( p, k ) )
486 r1 = dble( a( k, k ) )
487 a( k, k ) = dble( a( p, p ) )
494 $
CALL zswap( n-k, a( k, k+1 ), lda, a( p, k+1 ), lda )
504 $
CALL zswap( kp-1, a( 1, kk ), 1, a( 1, kp ), 1 )
506 DO 15 j = kp + 1, kk - 1
507 t = dconjg( a( j, kk ) )
508 a( j, kk ) = dconjg( a( kp, j ) )
512 a( kp, kk ) = dconjg( a( kp, kk ) )
514 r1 = dble( a( kk, kk ) )
515 a( kk, kk ) = dble( a( kp, kp ) )
518 IF( kstep.EQ.2 )
THEN
520 a( k, k ) = dble( a( k, k ) )
523 a( k-1, k ) = a( kp, k )
531 $
CALL zswap( n-k, a( kk, k+1 ), lda, a( kp, k+1 ),
536 a( k, k ) = dble( a( k, k ) )
538 $ a( k-1, k-1 ) = dble( a( k-1, k-1 ) )
543 IF( kstep.EQ.1 )
THEN
556 IF( abs( dble( a( k, k ) ) ).GE.sfmin )
THEN
562 d11 = one / dble( a( k, k ) )
563 CALL zher( uplo, k-1, -d11, a( 1, k ), 1, a, lda )
567 CALL zdscal( k-1, d11, a( 1, k ), 1 )
572 d11 = dble( a( k, k ) )
574 a( ii, k ) = a( ii, k ) / d11
582 CALL zher( uplo, k-1, -d11, a( 1, k ), 1, a, lda )
609 d = dlapy2( dble( a( k-1, k ) ),
610 $ dimag( a( k-1, k ) ) )
611 d11 = dble( a( k, k ) / d )
612 d22 = dble( a( k-1, k-1 ) / d )
613 d12 = a( k-1, k ) / d
614 tt = one / ( d11*d22-one )
616 DO 30 j = k - 2, 1, -1
620 wkm1 = tt*( d11*a( j, k-1 )-dconjg( d12 )*
622 wk = tt*( d22*a( j, k )-d12*a( j, k-1 ) )
627 a( i, j ) = a( i, j ) -
628 $ ( a( i, k ) / d )*dconjg( wk ) -
629 $ ( a( i, k-1 ) / d )*dconjg( wkm1 )
635 a( j, k-1 ) = wkm1 / d
637 a( j, j ) = dcmplx( dble( a( j, j ) ), zero )
658 IF( kstep.EQ.1 )
THEN
696 absakk = abs( dble( a( k, k ) ) )
703 imax = k + izamax( n-k, a( k+1, k ), 1 )
704 colmax = cabs1( a( imax, k ) )
709 IF( max( absakk, colmax ).EQ.zero )
THEN
716 a( k, k ) = dble( a( k, k ) )
733 IF( .NOT.( absakk.LT.alpha*colmax ) )
THEN
755 jmax = k - 1 + izamax( imax-k, a( imax, k ), lda )
756 rowmax = cabs1( a( imax, jmax ) )
762 itemp = imax + izamax( n-imax, a( imax+1, imax ),
764 dtemp = cabs1( a( itemp, imax ) )
765 IF( dtemp.GT.rowmax )
THEN
776 IF( .NOT.( abs( dble( a( imax, imax ) ) )
777 $ .LT.alpha*rowmax ) )
THEN
789 ELSE IF( ( p.EQ.jmax ) .OR. ( rowmax.LE.colmax ) )
812 IF( .NOT.done )
GOTO 42
827 IF( ( kstep.EQ.2 ) .AND. ( p.NE.k ) )
THEN
830 $
CALL zswap( n-p, a( p+1, k ), 1, a( p+1, p ), 1 )
832 DO 44 j = k + 1, p - 1
833 t = dconjg( a( j, k ) )
834 a( j, k ) = dconjg( a( p, j ) )
838 a( p, k ) = dconjg( a( p, k ) )
840 r1 = dble( a( k, k ) )
841 a( k, k ) = dble( a( p, p ) )
848 $
CALL zswap( k-1, a( k, 1 ), lda, a( p, 1 ), lda )
858 $
CALL zswap( n-kp, a( kp+1, kk ), 1, a( kp+1, kp ), 1 )
860 DO 45 j = kk + 1, kp - 1
861 t = dconjg( a( j, kk ) )
862 a( j, kk ) = dconjg( a( kp, j ) )
866 a( kp, kk ) = dconjg( a( kp, kk ) )
868 r1 = dble( a( kk, kk ) )
869 a( kk, kk ) = dble( a( kp, kp ) )
872 IF( kstep.EQ.2 )
THEN
874 a( k, k ) = dble( a( k, k ) )
877 a( k+1, k ) = a( kp, k )
885 $
CALL zswap( k-1, a( kk, 1 ), lda, a( kp, 1 ), lda )
889 a( k, k ) = dble( a( k, k ) )
891 $ a( k+1, k+1 ) = dble( a( k+1, k+1 ) )
896 IF( kstep.EQ.1 )
THEN
911 IF( abs( dble( a( k, k ) ) ).GE.sfmin )
THEN
917 d11 = one / dble( a( k, k ) )
918 CALL zher( uplo, n-k, -d11, a( k+1, k ), 1,
919 $ a( k+1, k+1 ), lda )
923 CALL zdscal( n-k, d11, a( k+1, k ), 1 )
928 d11 = dble( a( k, k ) )
930 a( ii, k ) = a( ii, k ) / d11
938 CALL zher( uplo, n-k, -d11, a( k+1, k ), 1,
939 $ a( k+1, k+1 ), lda )
967 d = dlapy2( dble( a( k+1, k ) ),
968 $ dimag( a( k+1, k ) ) )
969 d11 = dble( a( k+1, k+1 ) ) / d
970 d22 = dble( a( k, k ) ) / d
971 d21 = a( k+1, k ) / d
972 tt = one / ( d11*d22-one )
978 wk = tt*( d11*a( j, k )-d21*a( j, k+1 ) )
979 wkp1 = tt*( d22*a( j, k+1 )-dconjg( d21 )*
985 a( i, j ) = a( i, j ) -
986 $ ( a( i, k ) / d )*dconjg( wk ) -
987 $ ( a( i, k+1 ) / d )*dconjg( wkp1 )
993 a( j, k+1 ) = wkp1 / d
995 a( j, j ) = dcmplx( dble( a( j, j ) ), zero )
1004 e( k ) = a( k+1, k )
1016 IF( kstep.EQ.1 )
THEN
subroutine xerbla(srname, info)
subroutine zher(uplo, n, alpha, x, incx, a, lda)
ZHER
subroutine zhetf2_rk(uplo, n, a, lda, e, ipiv, info)
ZHETF2_RK computes the factorization of a complex Hermitian indefinite matrix using the bounded Bunch...
subroutine zdscal(n, da, zx, incx)
ZDSCAL
subroutine zswap(n, zx, incx, zy, incy)
ZSWAP