176 SUBROUTINE clahef( UPLO, N, NB, KB, A, LDA, IPIV, W, LDW, INFO )
184 INTEGER INFO, KB, LDA, LDW, N, NB
188 COMPLEX A( LDA, * ), W( LDW, * )
195 parameter( zero = 0.0e+0, one = 1.0e+0 )
197 parameter( cone = ( 1.0e+0, 0.0e+0 ) )
199 parameter( eight = 8.0e+0, sevten = 17.0e+0 )
202 INTEGER IMAX, J, JB, JJ, JMAX, JP, K, KK, KKW, KP,
204 REAL ABSAKK, ALPHA, COLMAX, R1, ROWMAX, T
205 COMPLEX D11, D21, D22, Z
210 EXTERNAL lsame, icamax
216 INTRINSIC abs, aimag, conjg, max, min, real, sqrt
222 cabs1( z ) = abs( real( z ) ) + abs( aimag( z ) )
230 alpha = ( one+sqrt( sevten ) ) / eight
232 IF( lsame( uplo,
'U' ) )
THEN
249 IF( ( k.LE.n-nb+1 .AND. nb.LT.n ) .OR. k.LT.1 )
256 CALL ccopy( k-1, a( 1, k ), 1, w( 1, kw ), 1 )
257 w( k, kw ) = real( a( k, k ) )
259 CALL cgemv(
'No transpose', k, n-k, -cone, a( 1, k+1 ), lda,
260 $ w( k, kw+1 ), ldw, cone, w( 1, kw ), 1 )
261 w( k, kw ) = real( w( k, kw ) )
267 absakk = abs( real( w( k, kw ) ) )
274 imax = icamax( k-1, w( 1, kw ), 1 )
275 colmax = cabs1( w( imax, kw ) )
280 IF( max( absakk, colmax ).EQ.zero )
THEN
287 a( k, k ) = real( a( k, k ) )
295 IF( absakk.GE.alpha*colmax )
THEN
307 CALL ccopy( imax-1, a( 1, imax ), 1, w( 1, kw-1 ), 1 )
308 w( imax, kw-1 ) = real( a( imax, imax ) )
309 CALL ccopy( k-imax, a( imax, imax+1 ), lda,
310 $ w( imax+1, kw-1 ), 1 )
311 CALL clacgv( k-imax, w( imax+1, kw-1 ), 1 )
313 CALL cgemv(
'No transpose', k, n-k, -cone,
314 $ a( 1, k+1 ), lda, w( imax, kw+1 ), ldw,
315 $ cone, w( 1, kw-1 ), 1 )
316 w( imax, kw-1 ) = real( w( imax, kw-1 ) )
323 jmax = imax + icamax( k-imax, w( imax+1, kw-1 ), 1 )
324 rowmax = cabs1( w( jmax, kw-1 ) )
326 jmax = icamax( imax-1, w( 1, kw-1 ), 1 )
327 rowmax = max( rowmax, cabs1( w( jmax, kw-1 ) ) )
331 IF( absakk.GE.alpha*colmax*( colmax / rowmax ) )
THEN
338 ELSE IF( abs( real( w( imax, kw-1 ) ) ).GE.alpha*rowmax )
348 CALL ccopy( k, w( 1, kw-1 ), 1, w( 1, kw ), 1 )
387 a( kp, kp ) = real( a( kk, kk ) )
388 CALL ccopy( kk-1-kp, a( kp+1, kk ), 1, a( kp, kp+1 ),
390 CALL clacgv( kk-1-kp, a( kp, kp+1 ), lda )
392 $
CALL ccopy( kp-1, a( 1, kk ), 1, a( 1, kp ), 1 )
400 $
CALL cswap( n-k, a( kk, k+1 ), lda, a( kp, k+1 ),
402 CALL cswap( n-kk+1, w( kk, kkw ), ldw, w( kp, kkw ),
406 IF( kstep.EQ.1 )
THEN
424 CALL ccopy( k, w( 1, kw ), 1, a( 1, k ), 1 )
431 r1 = one / real( a( k, k ) )
432 CALL csscal( k-1, r1, a( 1, k ), 1 )
436 CALL clacgv( k-1, w( 1, kw ), 1 )
501 d11 = w( k, kw ) / conjg( d21 )
502 d22 = w( k-1, kw-1 ) / d21
503 t = one / ( real( d11*d22 )-one )
511 a( j, k-1 ) = d21*( d11*w( j, kw-1 )-w( j, kw ) )
512 a( j, k ) = conjg( d21 )*
513 $ ( d22*w( j, kw )-w( j, kw-1 ) )
519 a( k-1, k-1 ) = w( k-1, kw-1 )
520 a( k-1, k ) = w( k-1, kw )
521 a( k, k ) = w( k, kw )
525 CALL clacgv( k-1, w( 1, kw ), 1 )
526 CALL clacgv( k-2, w( 1, kw-1 ), 1 )
534 IF( kstep.EQ.1 )
THEN
555 DO 50 j = ( ( k-1 ) / nb )*nb + 1, 1, -nb
556 jb = min( nb, k-j+1 )
560 DO 40 jj = j, j + jb - 1
561 a( jj, jj ) = real( a( jj, jj ) )
562 CALL cgemv(
'No transpose', jj-j+1, n-k, -cone,
563 $ a( j, k+1 ), lda, w( jj, kw+1 ), ldw, cone,
565 a( jj, jj ) = real( a( jj, jj ) )
570 CALL cgemm(
'No transpose',
'Transpose', j-1, jb, n-k,
571 $ -cone, a( 1, k+1 ), lda, w( j, kw+1 ), ldw,
572 $ cone, a( 1, j ), lda )
595 IF( jp.NE.jj .AND. j.LE.n )
596 $
CALL cswap( n-j+1, a( jp, j ), lda, a( jj, j ), lda )
617 IF( ( k.GE.nb .AND. nb.LT.n ) .OR. k.GT.n )
624 w( k, k ) = real( a( k, k ) )
626 $
CALL ccopy( n-k, a( k+1, k ), 1, w( k+1, k ), 1 )
627 CALL cgemv(
'No transpose', n-k+1, k-1, -cone, a( k, 1 ), lda,
628 $ w( k, 1 ), ldw, cone, w( k, k ), 1 )
629 w( k, k ) = real( w( k, k ) )
634 absakk = abs( real( w( k, k ) ) )
641 imax = k + icamax( n-k, w( k+1, k ), 1 )
642 colmax = cabs1( w( imax, k ) )
647 IF( max( absakk, colmax ).EQ.zero )
THEN
654 a( k, k ) = real( a( k, k ) )
662 IF( absakk.GE.alpha*colmax )
THEN
674 CALL ccopy( imax-k, a( imax, k ), lda, w( k, k+1 ), 1 )
675 CALL clacgv( imax-k, w( k, k+1 ), 1 )
676 w( imax, k+1 ) = real( a( imax, imax ) )
678 $
CALL ccopy( n-imax, a( imax+1, imax ), 1,
679 $ w( imax+1, k+1 ), 1 )
680 CALL cgemv(
'No transpose', n-k+1, k-1, -cone, a( k, 1 ),
681 $ lda, w( imax, 1 ), ldw, cone, w( k, k+1 ),
683 w( imax, k+1 ) = real( w( imax, k+1 ) )
689 jmax = k - 1 + icamax( imax-k, w( k, k+1 ), 1 )
690 rowmax = cabs1( w( jmax, k+1 ) )
692 jmax = imax + icamax( n-imax, w( imax+1, k+1 ), 1 )
693 rowmax = max( rowmax, cabs1( w( jmax, k+1 ) ) )
697 IF( absakk.GE.alpha*colmax*( colmax / rowmax ) )
THEN
704 ELSE IF( abs( real( w( imax, k+1 ) ) ).GE.alpha*rowmax )
714 CALL ccopy( n-k+1, w( k, k+1 ), 1, w( k, k ), 1 )
749 a( kp, kp ) = real( a( kk, kk ) )
750 CALL ccopy( kp-kk-1, a( kk+1, kk ), 1, a( kp, kk+1 ),
752 CALL clacgv( kp-kk-1, a( kp, kk+1 ), lda )
754 $
CALL ccopy( n-kp, a( kp+1, kk ), 1, a( kp+1, kp ), 1 )
762 $
CALL cswap( k-1, a( kk, 1 ), lda, a( kp, 1 ), lda )
763 CALL cswap( kk, w( kk, 1 ), ldw, w( kp, 1 ), ldw )
766 IF( kstep.EQ.1 )
THEN
784 CALL ccopy( n-k+1, w( k, k ), 1, a( k, k ), 1 )
791 r1 = one / real( a( k, k ) )
792 CALL csscal( n-k, r1, a( k+1, k ), 1 )
796 CALL clacgv( n-k, w( k+1, k ), 1 )
861 d11 = w( k+1, k+1 ) / d21
862 d22 = w( k, k ) / conjg( d21 )
863 t = one / ( real( d11*d22 )-one )
871 a( j, k ) = conjg( d21 )*
872 $ ( d11*w( j, k )-w( j, k+1 ) )
873 a( j, k+1 ) = d21*( d22*w( j, k+1 )-w( j, k ) )
879 a( k, k ) = w( k, k )
880 a( k+1, k ) = w( k+1, k )
881 a( k+1, k+1 ) = w( k+1, k+1 )
885 CALL clacgv( n-k, w( k+1, k ), 1 )
886 CALL clacgv( n-k-1, w( k+2, k+1 ), 1 )
894 IF( kstep.EQ.1 )
THEN
916 jb = min( nb, n-j+1 )
920 DO 100 jj = j, j + jb - 1
921 a( jj, jj ) = real( a( jj, jj ) )
922 CALL cgemv(
'No transpose', j+jb-jj, k-1, -cone,
923 $ a( jj, 1 ), lda, w( jj, 1 ), ldw, cone,
925 a( jj, jj ) = real( a( jj, jj ) )
931 $
CALL cgemm(
'No transpose',
'Transpose', n-j-jb+1, jb,
932 $ k-1, -cone, a( j+jb, 1 ), lda, w( j, 1 ),
933 $ ldw, cone, a( j+jb, j ), lda )
956 IF( jp.NE.jj .AND. j.GE.1 )
957 $
CALL cswap( j, a( jp, 1 ), lda, a( jj, 1 ), 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(uplo, n, nb, kb, a, lda, ipiv, w, ldw, info)
CLAHEF computes a partial factorization of a complex Hermitian indefinite matrix using the Bunch-Kauf...
subroutine csscal(n, sa, cx, incx)
CSSCAL
subroutine cswap(n, cx, incx, cy, incy)
CSWAP