252 COMPLEX A( LDA, * ), E( * )
259 parameter( zero = 0.0e+0, one = 1.0e+0 )
261 parameter( eight = 8.0e+0, sevten = 17.0e+0 )
263 parameter( czero = ( 0.0e+0, 0.0e+0 ) )
267 INTEGER I, II, IMAX, ITEMP, J, JMAX, K, KK, KP, KSTEP,
269 REAL ABSAKK, ALPHA, COLMAX, D, D11, D22, R1, STEMP,
271 COMPLEX D12, D21, T, WK, WKM1, WKP1, Z
278 EXTERNAL lsame, icamax, slamch, slapy2
284 INTRINSIC abs, aimag, cmplx, conjg, max, real, sqrt
290 cabs1( z ) = abs( real( z ) ) + abs( aimag( 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(
'CHETF2_RK', -info )
312 alpha = ( one+sqrt( sevten ) ) / eight
316 sfmin = slamch(
'S' )
343 absakk = abs( real( a( k, k ) ) )
350 imax = icamax( k-1, a( 1, k ), 1 )
351 colmax = cabs1( a( imax, k ) )
356 IF( ( max( absakk, colmax ).EQ.zero ) )
THEN
363 a( k, k ) = real( a( k, k ) )
380 IF( .NOT.( absakk.LT.alpha*colmax ) )
THEN
402 jmax = imax + icamax( k-imax, a( imax, imax+1 ),
404 rowmax = cabs1( a( imax, jmax ) )
410 itemp = icamax( imax-1, a( 1, imax ), 1 )
411 stemp = cabs1( a( itemp, imax ) )
412 IF( stemp.GT.rowmax )
THEN
423 IF( .NOT.( abs( real( 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 cswap( p-1, a( 1, k ), 1, a( 1, p ), 1 )
478 DO 14 j = p + 1, k - 1
479 t = conjg( a( j, k ) )
480 a( j, k ) = conjg( a( p, j ) )
484 a( p, k ) = conjg( a( p, k ) )
486 r1 = real( a( k, k ) )
487 a( k, k ) = real( a( p, p ) )
494 $
CALL cswap( n-k, a( k, k+1 ), lda, a( p, k+1 ), lda )
504 $
CALL cswap( kp-1, a( 1, kk ), 1, a( 1, kp ), 1 )
506 DO 15 j = kp + 1, kk - 1
507 t = conjg( a( j, kk ) )
508 a( j, kk ) = conjg( a( kp, j ) )
512 a( kp, kk ) = conjg( a( kp, kk ) )
514 r1 = real( a( kk, kk ) )
515 a( kk, kk ) = real( a( kp, kp ) )
518 IF( kstep.EQ.2 )
THEN
520 a( k, k ) = real( a( k, k ) )
523 a( k-1, k ) = a( kp, k )
531 $
CALL cswap( n-k, a( kk, k+1 ), lda, a( kp, k+1 ),
536 a( k, k ) = real( a( k, k ) )
538 $ a( k-1, k-1 ) = real( a( k-1, k-1 ) )
543 IF( kstep.EQ.1 )
THEN
556 IF( abs( real( a( k, k ) ) ).GE.sfmin )
THEN
562 d11 = one / real( a( k, k ) )
563 CALL cher( uplo, k-1, -d11, a( 1, k ), 1, a, lda )
567 CALL csscal( k-1, d11, a( 1, k ), 1 )
572 d11 = real( a( k, k ) )
574 a( ii, k ) = a( ii, k ) / d11
582 CALL cher( uplo, k-1, -d11, a( 1, k ), 1, a, lda )
609 d = slapy2( real( a( k-1, k ) ),
610 $ aimag( a( k-1, k ) ) )
611 d11 = real( a( k, k ) / d )
612 d22 = real( 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 )-conjg( 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 )*conjg( wk ) -
629 $ ( a( i, k-1 ) / d )*conjg( wkm1 )
635 a( j, k-1 ) = wkm1 / d
637 a( j, j ) = cmplx( real( a( j, j ) ), zero )
658 IF( kstep.EQ.1 )
THEN
696 absakk = abs( real( a( k, k ) ) )
703 imax = k + icamax( 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 ) = real( a( k, k ) )
733 IF( .NOT.( absakk.LT.alpha*colmax ) )
THEN
755 jmax = k - 1 + icamax( imax-k, a( imax, k ), lda )
756 rowmax = cabs1( a( imax, jmax ) )
762 itemp = imax + icamax( n-imax, a( imax+1, imax ),
764 stemp = cabs1( a( itemp, imax ) )
765 IF( stemp.GT.rowmax )
THEN
776 IF( .NOT.( abs( real( 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 cswap( n-p, a( p+1, k ), 1, a( p+1, p ), 1 )
832 DO 44 j = k + 1, p - 1
833 t = conjg( a( j, k ) )
834 a( j, k ) = conjg( a( p, j ) )
838 a( p, k ) = conjg( a( p, k ) )
840 r1 = real( a( k, k ) )
841 a( k, k ) = real( a( p, p ) )
848 $
CALL cswap( k-1, a( k, 1 ), lda, a( p, 1 ), lda )
858 $
CALL cswap( n-kp, a( kp+1, kk ), 1, a( kp+1, kp ), 1 )
860 DO 45 j = kk + 1, kp - 1
861 t = conjg( a( j, kk ) )
862 a( j, kk ) = conjg( a( kp, j ) )
866 a( kp, kk ) = conjg( a( kp, kk ) )
868 r1 = real( a( kk, kk ) )
869 a( kk, kk ) = real( a( kp, kp ) )
872 IF( kstep.EQ.2 )
THEN
874 a( k, k ) = real( a( k, k ) )
877 a( k+1, k ) = a( kp, k )
885 $
CALL cswap( k-1, a( kk, 1 ), lda, a( kp, 1 ), lda )
889 a( k, k ) = real( a( k, k ) )
891 $ a( k+1, k+1 ) = real( a( k+1, k+1 ) )
896 IF( kstep.EQ.1 )
THEN
911 IF( abs( real( a( k, k ) ) ).GE.sfmin )
THEN
917 d11 = one / real( a( k, k ) )
918 CALL cher( uplo, n-k, -d11, a( k+1, k ), 1,
919 $ a( k+1, k+1 ), lda )
923 CALL csscal( n-k, d11, a( k+1, k ), 1 )
928 d11 = real( a( k, k ) )
930 a( ii, k ) = a( ii, k ) / d11
938 CALL cher( uplo, n-k, -d11, a( k+1, k ), 1,
939 $ a( k+1, k+1 ), lda )
967 d = slapy2( real( a( k+1, k ) ),
968 $ aimag( a( k+1, k ) ) )
969 d11 = real( a( k+1, k+1 ) ) / d
970 d22 = real( 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 )-conjg( d21 )*
985 a( i, j ) = a( i, j ) -
986 $ ( a( i, k ) / d )*conjg( wk ) -
987 $ ( a( i, k+1 ) / d )*conjg( wkp1 )
993 a( j, k+1 ) = wkp1 / d
995 a( j, j ) = cmplx( real( a( j, j ) ), zero )
1004 e( k ) = a( k+1, k )
1016 IF( kstep.EQ.1 )
THEN
subroutine xerbla(srname, info)
subroutine cher(uplo, n, alpha, x, incx, a, lda)
CHER
subroutine chetf2_rk(uplo, n, a, lda, e, ipiv, info)
CHETF2_RK computes the factorization of a complex Hermitian indefinite matrix using the bounded Bunch...
subroutine csscal(n, sa, cx, incx)
CSSCAL
subroutine cswap(n, cx, incx, cy, incy)
CSWAP