260 SUBROUTINE clahef_rk( UPLO, N, NB, KB, A, LDA, E, IPIV, W, LDW,
269 INTEGER INFO, KB, LDA, LDW, N, NB
273 COMPLEX A( LDA, * ), W( LDW, * ), E( * )
280 parameter( zero = 0.0e+0, one = 1.0e+0 )
282 parameter( eight = 8.0e+0, sevten = 17.0e+0 )
284 parameter( cone = ( 1.0e+0, 0.0e+0 ),
285 $ czero = ( 0.0e+0, 0.0e+0 ) )
289 INTEGER IMAX, ITEMP, II, J, JB, JJ, JMAX, K, KK, KKW,
291 REAL ABSAKK, ALPHA, COLMAX, STEMP, R1, ROWMAX, T,
293 COMPLEX D11, D21, D22, Z
299 EXTERNAL lsame, icamax, slamch
305 INTRINSIC abs, conjg, aimag, max, min, real, sqrt
311 cabs1( z ) = abs( real( z ) ) + abs( aimag( z ) )
319 alpha = ( one+sqrt( sevten ) ) / eight
323 sfmin = slamch(
'S' )
325 IF( lsame( uplo,
'U' ) )
THEN
347 IF( ( k.LE.n-nb+1 .AND. nb.LT.n ) .OR. k.LT.1 )
356 $
CALL ccopy( k-1, a( 1, k ), 1, w( 1, kw ), 1 )
357 w( k, kw ) = real( a( k, k ) )
359 CALL cgemv(
'No transpose', k, n-k, -cone, a( 1, k+1 ), lda,
360 $ w( k, kw+1 ), ldw, cone, w( 1, kw ), 1 )
361 w( k, kw ) = real( w( k, kw ) )
367 absakk = abs( real( w( k, kw ) ) )
374 imax = icamax( k-1, w( 1, kw ), 1 )
375 colmax = cabs1( w( imax, kw ) )
380 IF( max( absakk, colmax ).EQ.zero )
THEN
387 a( k, k ) = real( w( k, kw ) )
389 $
CALL ccopy( k-1, w( 1, kw ), 1, a( 1, k ), 1 )
405 IF( .NOT.( absakk.LT.alpha*colmax ) )
THEN
425 $
CALL ccopy( imax-1, a( 1, imax ), 1, w( 1, kw-1 ),
427 w( imax, kw-1 ) = real( a( imax, imax ) )
429 CALL ccopy( k-imax, a( imax, imax+1 ), lda,
430 $ w( imax+1, kw-1 ), 1 )
431 CALL clacgv( k-imax, w( imax+1, kw-1 ), 1 )
434 CALL cgemv(
'No transpose', k, n-k, -cone,
435 $ a( 1, k+1 ), lda, w( imax, kw+1 ), ldw,
436 $ cone, w( 1, kw-1 ), 1 )
437 w( imax, kw-1 ) = real( w( imax, kw-1 ) )
445 jmax = imax + icamax( k-imax, w( imax+1, kw-1 ),
447 rowmax = cabs1( w( jmax, kw-1 ) )
453 itemp = icamax( imax-1, w( 1, kw-1 ), 1 )
454 stemp = cabs1( w( itemp, kw-1 ) )
455 IF( stemp.GT.rowmax )
THEN
466 IF( .NOT.( abs( real( w( imax,kw-1 ) ) )
467 $ .LT.alpha*rowmax ) )
THEN
476 CALL ccopy( k, w( 1, kw-1 ), 1, w( 1, kw ), 1 )
484 ELSE IF( ( p.EQ.jmax ) .OR. ( rowmax.LE.colmax ) )
505 CALL ccopy( k, w( 1, kw-1 ), 1, w( 1, kw ), 1 )
512 IF( .NOT.done )
GOTO 12
531 IF( ( kstep.EQ.2 ) .AND. ( p.NE.k ) )
THEN
538 a( p, p ) = real( a( k, k ) )
539 CALL ccopy( k-1-p, a( p+1, k ), 1, a( p, p+1 ),
541 CALL clacgv( k-1-p, a( p, p+1 ), lda )
543 $
CALL ccopy( p-1, a( 1, k ), 1, a( 1, p ), 1 )
551 $
CALL cswap( n-k, a( k, k+1 ), lda, a( p, k+1 ),
553 CALL cswap( n-kk+1, w( k, kkw ), ldw, w( p, kkw ),
567 a( kp, kp ) = real( a( kk, kk ) )
568 CALL ccopy( kk-1-kp, a( kp+1, kk ), 1, a( kp, kp+1 ),
570 CALL clacgv( kk-1-kp, a( kp, kp+1 ), lda )
572 $
CALL ccopy( kp-1, a( 1, kk ), 1, a( 1, kp ), 1 )
580 $
CALL cswap( n-k, a( kk, k+1 ), lda, a( kp, k+1 ),
582 CALL cswap( n-kk+1, w( kk, kkw ), ldw, w( kp, kkw ),
586 IF( kstep.EQ.1 )
THEN
604 CALL ccopy( k, w( 1, kw ), 1, a( 1, k ), 1 )
613 t = real( a( k, k ) )
614 IF( abs( t ).GE.sfmin )
THEN
616 CALL csscal( k-1, r1, a( 1, k ), 1 )
619 a( ii, k ) = a( ii, k ) / t
625 CALL clacgv( k-1, w( 1, kw ), 1 )
698 d11 = w( k, kw ) / conjg( d21 )
699 d22 = w( k-1, kw-1 ) / d21
700 t = one / ( real( d11*d22 )-one )
707 a( j, k-1 ) = t*( ( d11*w( j, kw-1 )-w( j, kw ) ) /
709 a( j, k ) = t*( ( d22*w( j, kw )-w( j, kw-1 ) ) /
718 a( k-1, k-1 ) = w( k-1, kw-1 )
720 a( k, k ) = w( k, kw )
721 e( k ) = w( k-1, kw )
726 CALL clacgv( k-1, w( 1, kw ), 1 )
727 CALL clacgv( k-2, w( 1, kw-1 ), 1 )
737 IF( kstep.EQ.1 )
THEN
758 DO 50 j = ( ( k-1 ) / nb )*nb + 1, 1, -nb
759 jb = min( nb, k-j+1 )
763 DO 40 jj = j, j + jb - 1
764 a( jj, jj ) = real( a( jj, jj ) )
765 CALL cgemv(
'No transpose', jj-j+1, n-k, -cone,
766 $ a( j, k+1 ), lda, w( jj, kw+1 ), ldw, cone,
768 a( jj, jj ) = real( a( jj, jj ) )
774 $
CALL cgemm(
'No transpose',
'Transpose', j-1, jb, n-k,
775 $ -cone, a( 1, k+1 ), lda, w( j, kw+1 ), ldw,
776 $ cone, a( 1, j ), lda )
800 IF( ( k.GE.nb .AND. nb.LT.n ) .OR. k.GT.n )
808 w( k, k ) = real( a( k, k ) )
810 $
CALL ccopy( n-k, a( k+1, k ), 1, w( k+1, k ), 1 )
812 CALL cgemv(
'No transpose', n-k+1, k-1, -cone, a( k, 1 ),
813 $ lda, w( k, 1 ), ldw, cone, w( k, k ), 1 )
814 w( k, k ) = real( w( k, k ) )
820 absakk = abs( real( w( k, k ) ) )
827 imax = k + icamax( n-k, w( k+1, k ), 1 )
828 colmax = cabs1( w( imax, k ) )
833 IF( max( absakk, colmax ).EQ.zero )
THEN
840 a( k, k ) = real( w( k, k ) )
842 $
CALL ccopy( n-k, w( k+1, k ), 1, a( k+1, k ), 1 )
859 IF( .NOT.( absakk.LT.alpha*colmax ) )
THEN
878 CALL ccopy( imax-k, a( imax, k ), lda, w( k, k+1 ), 1)
879 CALL clacgv( imax-k, w( k, k+1 ), 1 )
880 w( imax, k+1 ) = real( a( imax, imax ) )
883 $
CALL ccopy( n-imax, a( imax+1, imax ), 1,
884 $ w( imax+1, k+1 ), 1 )
887 CALL cgemv(
'No transpose', n-k+1, k-1, -cone,
888 $ a( k, 1 ), lda, w( imax, 1 ), ldw,
889 $ cone, w( k, k+1 ), 1 )
890 w( imax, k+1 ) = real( w( imax, k+1 ) )
898 jmax = k - 1 + icamax( imax-k, w( k, k+1 ), 1 )
899 rowmax = cabs1( w( jmax, k+1 ) )
905 itemp = imax + icamax( n-imax, w( imax+1, k+1 ), 1)
906 stemp = cabs1( w( itemp, k+1 ) )
907 IF( stemp.GT.rowmax )
THEN
918 IF( .NOT.( abs( real( w( imax,k+1 ) ) )
919 $ .LT.alpha*rowmax ) )
THEN
928 CALL ccopy( n-k+1, w( k, k+1 ), 1, w( k, k ), 1 )
936 ELSE IF( ( p.EQ.jmax ) .OR. ( rowmax.LE.colmax ) )
957 CALL ccopy( n-k+1, w( k, k+1 ), 1, w( k, k ), 1 )
964 IF( .NOT.done )
GOTO 72
979 IF( ( kstep.EQ.2 ) .AND. ( p.NE.k ) )
THEN
986 a( p, p ) = real( a( k, k ) )
987 CALL ccopy( p-k-1, a( k+1, k ), 1, a( p, k+1 ), lda )
988 CALL clacgv( p-k-1, a( p, k+1 ), lda )
990 $
CALL ccopy( n-p, a( p+1, k ), 1, a( p+1, p ), 1 )
998 $
CALL cswap( k-1, a( k, 1 ), lda, a( p, 1 ), lda )
999 CALL cswap( kk, w( k, 1 ), ldw, w( p, 1 ), ldw )
1012 a( kp, kp ) = real( a( kk, kk ) )
1013 CALL ccopy( kp-kk-1, a( kk+1, kk ), 1, a( kp, kk+1 ),
1015 CALL clacgv( kp-kk-1, a( kp, kk+1 ), lda )
1017 $
CALL ccopy( n-kp, a( kp+1, kk ), 1, a( kp+1, kp ), 1 )
1025 $
CALL cswap( k-1, a( kk, 1 ), lda, a( kp, 1 ), lda )
1026 CALL cswap( kk, w( kk, 1 ), ldw, w( kp, 1 ), ldw )
1029 IF( kstep.EQ.1 )
THEN
1047 CALL ccopy( n-k+1, w( k, k ), 1, a( k, k ), 1 )
1056 t = real( a( k, k ) )
1057 IF( abs( t ).GE.sfmin )
THEN
1059 CALL csscal( n-k, r1, a( k+1, k ), 1 )
1062 a( ii, k ) = a( ii, k ) / t
1068 CALL clacgv( n-k, w( k+1, k ), 1 )
1141 d11 = w( k+1, k+1 ) / d21
1142 d22 = w( k, k ) / conjg( d21 )
1143 t = one / ( real( d11*d22 )-one )
1150 a( j, k ) = t*( ( d11*w( j, k )-w( j, k+1 ) ) /
1152 a( j, k+1 ) = t*( ( d22*w( j, k+1 )-w( j, k ) ) /
1161 a( k, k ) = w( k, k )
1163 a( k+1, k+1 ) = w( k+1, k+1 )
1164 e( k ) = w( k+1, k )
1169 CALL clacgv( n-k, w( k+1, k ), 1 )
1170 CALL clacgv( n-k-1, w( k+2, k+1 ), 1 )
1180 IF( kstep.EQ.1 )
THEN
1202 jb = min( nb, n-j+1 )
1206 DO 100 jj = j, j + jb - 1
1207 a( jj, jj ) = real( a( jj, jj ) )
1208 CALL cgemv(
'No transpose', j+jb-jj, k-1, -cone,
1209 $ a( jj, 1 ), lda, w( jj, 1 ), ldw, cone,
1211 a( jj, jj ) = real( a( jj, jj ) )
1217 $
CALL cgemm(
'No transpose',
'Transpose', n-j-jb+1, jb,
1218 $ k-1, -cone, a( j+jb, 1 ), lda, w( j, 1 ),
1219 $ ldw, cone, a( j+jb, j ), lda )
subroutine ccopy(n, cx, incx, cy, incy)
CCOPY
subroutine cgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
CGEMM
subroutine cgemv(trans, m, n, alpha, a, lda, x, incx, beta, y, incy)
CGEMV
subroutine clacgv(n, x, incx)
CLACGV conjugates a complex vector.
subroutine clahef_rk(uplo, n, nb, kb, a, lda, e, ipiv, w, ldw, info)
CLAHEF_RK computes a partial factorization of a complex Hermitian indefinite matrix using bounded Bun...
subroutine csscal(n, sa, cx, incx)
CSSCAL
subroutine cswap(n, cx, incx, cy, incy)
CSWAP