176 SUBROUTINE zlahef( UPLO, N, NB, KB, A, LDA, IPIV, W, LDW, INFO )
184 INTEGER INFO, KB, LDA, LDW, N, NB
188 COMPLEX*16 A( LDA, * ), W( LDW, * )
194 DOUBLE PRECISION ZERO, ONE
195 parameter( zero = 0.0d+0, one = 1.0d+0 )
197 parameter( cone = ( 1.0d+0, 0.0d+0 ) )
198 DOUBLE PRECISION EIGHT, SEVTEN
199 parameter( eight = 8.0d+0, sevten = 17.0d+0 )
202 INTEGER IMAX, J, JB, JJ, JMAX, JP, K, KK, KKW, KP,
204 DOUBLE PRECISION ABSAKK, ALPHA, COLMAX, R1, ROWMAX, T
205 COMPLEX*16 D11, D21, D22, Z
210 EXTERNAL lsame, izamax
216 INTRINSIC abs, dble, dconjg, dimag, max, min, sqrt
219 DOUBLE PRECISION CABS1
222 cabs1( z ) = abs( dble( z ) ) + abs( dimag( z ) )
230 alpha = ( one+sqrt( sevten ) ) / eight
232 IF( lsame( uplo,
'U' ) )
THEN
248 IF( ( k.LE.n-nb+1 .AND. nb.LT.n ) .OR. k.LT.1 )
255 CALL zcopy( k-1, a( 1, k ), 1, w( 1, kw ), 1 )
256 w( k, kw ) = dble( a( k, k ) )
258 CALL zgemv(
'No transpose', k, n-k, -cone, a( 1, k+1 ), lda,
259 $ w( k, kw+1 ), ldw, cone, w( 1, kw ), 1 )
260 w( k, kw ) = dble( w( k, kw ) )
266 absakk = abs( dble( w( k, kw ) ) )
273 imax = izamax( k-1, w( 1, kw ), 1 )
274 colmax = cabs1( w( imax, kw ) )
279 IF( max( absakk, colmax ).EQ.zero )
THEN
286 a( k, k ) = dble( a( k, k ) )
294 IF( absakk.GE.alpha*colmax )
THEN
306 CALL zcopy( imax-1, a( 1, imax ), 1, w( 1, kw-1 ), 1 )
307 w( imax, kw-1 ) = dble( a( imax, imax ) )
308 CALL zcopy( k-imax, a( imax, imax+1 ), lda,
309 $ w( imax+1, kw-1 ), 1 )
310 CALL zlacgv( k-imax, w( imax+1, kw-1 ), 1 )
312 CALL zgemv(
'No transpose', k, n-k, -cone,
313 $ a( 1, k+1 ), lda, w( imax, kw+1 ), ldw,
314 $ cone, w( 1, kw-1 ), 1 )
315 w( imax, kw-1 ) = dble( w( imax, kw-1 ) )
322 jmax = imax + izamax( k-imax, w( imax+1, kw-1 ), 1 )
323 rowmax = cabs1( w( jmax, kw-1 ) )
325 jmax = izamax( imax-1, w( 1, kw-1 ), 1 )
326 rowmax = max( rowmax, cabs1( w( jmax, kw-1 ) ) )
330 IF( absakk.GE.alpha*colmax*( colmax / rowmax ) )
THEN
337 ELSE IF( abs( dble( w( imax, kw-1 ) ) ).GE.alpha*rowmax )
347 CALL zcopy( k, w( 1, kw-1 ), 1, w( 1, kw ), 1 )
386 a( kp, kp ) = dble( a( kk, kk ) )
387 CALL zcopy( kk-1-kp, a( kp+1, kk ), 1, a( kp, kp+1 ),
389 CALL zlacgv( kk-1-kp, a( kp, kp+1 ), lda )
391 $
CALL zcopy( kp-1, a( 1, kk ), 1, a( 1, kp ), 1 )
399 $
CALL zswap( n-k, a( kk, k+1 ), lda, a( kp, k+1 ),
401 CALL zswap( n-kk+1, w( kk, kkw ), ldw, w( kp, kkw ),
405 IF( kstep.EQ.1 )
THEN
423 CALL zcopy( k, w( 1, kw ), 1, a( 1, k ), 1 )
430 r1 = one / dble( a( k, k ) )
431 CALL zdscal( k-1, r1, a( 1, k ), 1 )
435 CALL zlacgv( k-1, w( 1, kw ), 1 )
500 d11 = w( k, kw ) / dconjg( d21 )
501 d22 = w( k-1, kw-1 ) / d21
502 t = one / ( dble( d11*d22 )-one )
510 a( j, k-1 ) = d21*( d11*w( j, kw-1 )-w( j, kw ) )
511 a( j, k ) = dconjg( d21 )*
512 $ ( d22*w( j, kw )-w( j, kw-1 ) )
518 a( k-1, k-1 ) = w( k-1, kw-1 )
519 a( k-1, k ) = w( k-1, kw )
520 a( k, k ) = w( k, kw )
524 CALL zlacgv( k-1, w( 1, kw ), 1 )
525 CALL zlacgv( k-2, w( 1, kw-1 ), 1 )
533 IF( kstep.EQ.1 )
THEN
554 DO 50 j = ( ( k-1 ) / nb )*nb + 1, 1, -nb
555 jb = min( nb, k-j+1 )
559 DO 40 jj = j, j + jb - 1
560 a( jj, jj ) = dble( a( jj, jj ) )
561 CALL zgemv(
'No transpose', jj-j+1, n-k, -cone,
562 $ a( j, k+1 ), lda, w( jj, kw+1 ), ldw, cone,
564 a( jj, jj ) = dble( a( jj, jj ) )
569 CALL zgemm(
'No transpose',
'Transpose', j-1, jb, n-k,
570 $ -cone, a( 1, k+1 ), lda, w( j, kw+1 ), ldw,
571 $ cone, a( 1, j ), lda )
594 IF( jp.NE.jj .AND. j.LE.n )
595 $
CALL zswap( n-j+1, a( jp, j ), lda, a( jj, j ), lda )
616 IF( ( k.GE.nb .AND. nb.LT.n ) .OR. k.GT.n )
623 w( k, k ) = dble( a( k, k ) )
625 $
CALL zcopy( n-k, a( k+1, k ), 1, w( k+1, k ), 1 )
626 CALL zgemv(
'No transpose', n-k+1, k-1, -cone, a( k, 1 ), lda,
627 $ w( k, 1 ), ldw, cone, w( k, k ), 1 )
628 w( k, k ) = dble( w( k, k ) )
633 absakk = abs( dble( w( k, k ) ) )
640 imax = k + izamax( n-k, w( k+1, k ), 1 )
641 colmax = cabs1( w( imax, k ) )
646 IF( max( absakk, colmax ).EQ.zero )
THEN
653 a( k, k ) = dble( a( k, k ) )
661 IF( absakk.GE.alpha*colmax )
THEN
673 CALL zcopy( imax-k, a( imax, k ), lda, w( k, k+1 ), 1 )
674 CALL zlacgv( imax-k, w( k, k+1 ), 1 )
675 w( imax, k+1 ) = dble( a( imax, imax ) )
677 $
CALL zcopy( n-imax, a( imax+1, imax ), 1,
678 $ w( imax+1, k+1 ), 1 )
679 CALL zgemv(
'No transpose', n-k+1, k-1, -cone, a( k, 1 ),
680 $ lda, w( imax, 1 ), ldw, cone, w( k, k+1 ),
682 w( imax, k+1 ) = dble( w( imax, k+1 ) )
688 jmax = k - 1 + izamax( imax-k, w( k, k+1 ), 1 )
689 rowmax = cabs1( w( jmax, k+1 ) )
691 jmax = imax + izamax( n-imax, w( imax+1, k+1 ), 1 )
692 rowmax = max( rowmax, cabs1( w( jmax, k+1 ) ) )
696 IF( absakk.GE.alpha*colmax*( colmax / rowmax ) )
THEN
703 ELSE IF( abs( dble( w( imax, k+1 ) ) ).GE.alpha*rowmax )
713 CALL zcopy( n-k+1, w( k, k+1 ), 1, w( k, k ), 1 )
748 a( kp, kp ) = dble( a( kk, kk ) )
749 CALL zcopy( kp-kk-1, a( kk+1, kk ), 1, a( kp, kk+1 ),
751 CALL zlacgv( kp-kk-1, a( kp, kk+1 ), lda )
753 $
CALL zcopy( n-kp, a( kp+1, kk ), 1, a( kp+1, kp ), 1 )
761 $
CALL zswap( k-1, a( kk, 1 ), lda, a( kp, 1 ), lda )
762 CALL zswap( kk, w( kk, 1 ), ldw, w( kp, 1 ), ldw )
765 IF( kstep.EQ.1 )
THEN
783 CALL zcopy( n-k+1, w( k, k ), 1, a( k, k ), 1 )
790 r1 = one / dble( a( k, k ) )
791 CALL zdscal( n-k, r1, a( k+1, k ), 1 )
795 CALL zlacgv( n-k, w( k+1, k ), 1 )
860 d11 = w( k+1, k+1 ) / d21
861 d22 = w( k, k ) / dconjg( d21 )
862 t = one / ( dble( d11*d22 )-one )
870 a( j, k ) = dconjg( d21 )*
871 $ ( d11*w( j, k )-w( j, k+1 ) )
872 a( j, k+1 ) = d21*( d22*w( j, k+1 )-w( j, k ) )
878 a( k, k ) = w( k, k )
879 a( k+1, k ) = w( k+1, k )
880 a( k+1, k+1 ) = w( k+1, k+1 )
884 CALL zlacgv( n-k, w( k+1, k ), 1 )
885 CALL zlacgv( n-k-1, w( k+2, k+1 ), 1 )
893 IF( kstep.EQ.1 )
THEN
915 jb = min( nb, n-j+1 )
919 DO 100 jj = j, j + jb - 1
920 a( jj, jj ) = dble( a( jj, jj ) )
921 CALL zgemv(
'No transpose', j+jb-jj, k-1, -cone,
922 $ a( jj, 1 ), lda, w( jj, 1 ), ldw, cone,
924 a( jj, jj ) = dble( a( jj, jj ) )
930 $
CALL zgemm(
'No transpose',
'Transpose', n-j-jb+1, jb,
931 $ k-1, -cone, a( j+jb, 1 ), lda, w( j, 1 ),
932 $ ldw, cone, a( j+jb, j ), lda )
955 IF( jp.NE.jj .AND. j.GE.1 )
956 $
CALL zswap( j, a( jp, 1 ), lda, a( jj, 1 ), lda )
subroutine zcopy(n, zx, incx, zy, incy)
ZCOPY
subroutine zgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
ZGEMM
subroutine zgemv(trans, m, n, alpha, a, lda, x, incx, beta, y, incy)
ZGEMV
subroutine zlacgv(n, x, incx)
ZLACGV conjugates a complex vector.
subroutine zlahef(uplo, n, nb, kb, a, lda, ipiv, w, ldw, info)
ZLAHEF computes a partial factorization of a complex Hermitian indefinite matrix using the Bunch-Kauf...
subroutine zdscal(n, da, zx, incx)
ZDSCAL
subroutine zswap(n, zx, incx, zy, incy)
ZSWAP