205 COMPLEX*16 A( LDA, * )
211 DOUBLE PRECISION ZERO, ONE
212 parameter( zero = 0.0d+0, one = 1.0d+0 )
213 DOUBLE PRECISION EIGHT, SEVTEN
214 parameter( eight = 8.0d+0, sevten = 17.0d+0 )
218 INTEGER I, II, IMAX, ITEMP, J, JMAX, K, KK, KP, KSTEP,
220 DOUBLE PRECISION ABSAKK, ALPHA, COLMAX, D, D11, D22, R1, DTEMP,
222 COMPLEX*16 D12, D21, T, WK, WKM1, WKP1, Z
228 DOUBLE PRECISION DLAMCH, DLAPY2
229 EXTERNAL lsame, izamax, dlamch, dlapy2
235 INTRINSIC abs, dble, dcmplx, dconjg, dimag, max, sqrt
238 DOUBLE PRECISION CABS1
241 cabs1( z ) = abs( dble( z ) ) + abs( dimag( 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(
'ZHETF2_ROOK', -info )
263 alpha = ( one+sqrt( sevten ) ) / eight
267 sfmin = dlamch(
'S' )
289 absakk = abs( dble( a( k, k ) ) )
296 imax = izamax( k-1, a( 1, k ), 1 )
297 colmax = cabs1( a( imax, k ) )
302 IF( ( max( absakk, colmax ).EQ.zero ) )
THEN
309 a( k, k ) = dble( a( k, k ) )
320 IF( .NOT.( absakk.LT.alpha*colmax ) )
THEN
342 jmax = imax + izamax( k-imax, a( imax, imax+1 ),
344 rowmax = cabs1( a( imax, jmax ) )
350 itemp = izamax( imax-1, a( 1, imax ), 1 )
351 dtemp = cabs1( a( itemp, imax ) )
352 IF( dtemp.GT.rowmax )
THEN
363 IF( .NOT.( abs( dble( 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 zswap( p-1, a( 1, k ), 1, a( 1, p ), 1 )
418 DO 14 j = p + 1, k - 1
419 t = dconjg( a( j, k ) )
420 a( j, k ) = dconjg( a( p, j ) )
424 a( p, k ) = dconjg( a( p, k ) )
426 r1 = dble( a( k, k ) )
427 a( k, k ) = dble( a( p, p ) )
437 $
CALL zswap( kp-1, a( 1, kk ), 1, a( 1, kp ), 1 )
439 DO 15 j = kp + 1, kk - 1
440 t = dconjg( a( j, kk ) )
441 a( j, kk ) = dconjg( a( kp, j ) )
445 a( kp, kk ) = dconjg( a( kp, kk ) )
447 r1 = dble( a( kk, kk ) )
448 a( kk, kk ) = dble( a( kp, kp ) )
451 IF( kstep.EQ.2 )
THEN
453 a( k, k ) = dble( a( k, k ) )
456 a( k-1, k ) = a( kp, k )
461 a( k, k ) = dble( a( k, k ) )
463 $ a( k-1, k-1 ) = dble( a( k-1, k-1 ) )
468 IF( kstep.EQ.1 )
THEN
481 IF( abs( dble( a( k, k ) ) ).GE.sfmin )
THEN
487 d11 = one / dble( a( k, k ) )
488 CALL zher( uplo, k-1, -d11, a( 1, k ), 1, a, lda )
492 CALL zdscal( k-1, d11, a( 1, k ), 1 )
497 d11 = dble( a( k, k ) )
499 a( ii, k ) = a( ii, k ) / d11
507 CALL zher( uplo, k-1, -d11, a( 1, k ), 1, a, lda )
529 d = dlapy2( dble( a( k-1, k ) ),
530 $ dimag( a( k-1, k ) ) )
531 d11 = dble( a( k, k ) / d )
532 d22 = dble( 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 )-dconjg( 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 )*dconjg( wk ) -
549 $ ( a( i, k-1 ) / d )*dconjg( wkm1 )
555 a( j, k-1 ) = wkm1 / d
557 a( j, j ) = dcmplx( dble( a( j, j ) ), zero )
569 IF( kstep.EQ.1 )
THEN
601 absakk = abs( dble( a( k, k ) ) )
608 imax = k + izamax( 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 ) = dble( a( k, k ) )
632 IF( .NOT.( absakk.LT.alpha*colmax ) )
THEN
654 jmax = k - 1 + izamax( imax-k, a( imax, k ), lda )
655 rowmax = cabs1( a( imax, jmax ) )
661 itemp = imax + izamax( n-imax, a( imax+1, imax ),
663 dtemp = cabs1( a( itemp, imax ) )
664 IF( dtemp.GT.rowmax )
THEN
675 IF( .NOT.( abs( dble( 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 zswap( n-p, a( p+1, k ), 1, a( p+1, p ), 1 )
731 DO 44 j = k + 1, p - 1
732 t = dconjg( a( j, k ) )
733 a( j, k ) = dconjg( a( p, j ) )
737 a( p, k ) = dconjg( a( p, k ) )
739 r1 = dble( a( k, k ) )
740 a( k, k ) = dble( a( p, p ) )
750 $
CALL zswap( n-kp, a( kp+1, kk ), 1, a( kp+1, kp ), 1 )
752 DO 45 j = kk + 1, kp - 1
753 t = dconjg( a( j, kk ) )
754 a( j, kk ) = dconjg( a( kp, j ) )
758 a( kp, kk ) = dconjg( a( kp, kk ) )
760 r1 = dble( a( kk, kk ) )
761 a( kk, kk ) = dble( a( kp, kp ) )
764 IF( kstep.EQ.2 )
THEN
766 a( k, k ) = dble( a( k, k ) )
769 a( k+1, k ) = a( kp, k )
774 a( k, k ) = dble( a( k, k ) )
776 $ a( k+1, k+1 ) = dble( a( k+1, k+1 ) )
781 IF( kstep.EQ.1 )
THEN
796 IF( abs( dble( a( k, k ) ) ).GE.sfmin )
THEN
802 d11 = one / dble( a( k, k ) )
803 CALL zher( uplo, n-k, -d11, a( k+1, k ), 1,
804 $ a( k+1, k+1 ), lda )
808 CALL zdscal( n-k, d11, a( k+1, k ), 1 )
813 d11 = dble( a( k, k ) )
815 a( ii, k ) = a( ii, k ) / d11
823 CALL zher( uplo, n-k, -d11, a( k+1, k ), 1,
824 $ a( k+1, k+1 ), lda )
847 d = dlapy2( dble( a( k+1, k ) ),
848 $ dimag( a( k+1, k ) ) )
849 d11 = dble( a( k+1, k+1 ) ) / d
850 d22 = dble( 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 )-dconjg( d21 )*
865 a( i, j ) = a( i, j ) -
866 $ ( a( i, k ) / d )*dconjg( wk ) -
867 $ ( a( i, k+1 ) / d )*dconjg( wkp1 )
873 a( j, k+1 ) = wkp1 / d
875 a( j, j ) = dcmplx( dble( a( j, j ) ), zero )
887 IF( kstep.EQ.1 )
THEN
subroutine xerbla(srname, info)
subroutine zher(uplo, n, alpha, x, incx, a, lda)
ZHER
subroutine zhetf2_rook(uplo, n, a, lda, ipiv, info)
ZHETF2_ROOK computes the factorization of a complex Hermitian indefinite matrix using the bounded Bun...
subroutine zdscal(n, da, zx, incx)
ZDSCAL
subroutine zswap(n, zx, incx, zy, incy)
ZSWAP