174 SUBROUTINE zlahef( UPLO, N, NB, KB, A, LDA, IPIV, W, LDW,
183 INTEGER INFO, KB, LDA, LDW, N, NB
187 COMPLEX*16 A( LDA, * ), W( LDW, * )
193 DOUBLE PRECISION ZERO, ONE
194 parameter( zero = 0.0d+0, one = 1.0d+0 )
196 parameter( cone = ( 1.0d+0, 0.0d+0 ) )
197 DOUBLE PRECISION EIGHT, SEVTEN
198 parameter( eight = 8.0d+0, sevten = 17.0d+0 )
201 INTEGER IMAX, J, JJ, JMAX, JP, K, KK, KKW, KP,
203 DOUBLE PRECISION ABSAKK, ALPHA, COLMAX, R1, ROWMAX, T
204 COMPLEX*16 D11, D21, D22, Z
209 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 ),
260 $ w( k, kw+1 ), ldw, cone, w( 1, kw ), 1 )
261 w( k, kw ) = dble( w( k, kw ) )
267 absakk = abs( dble( w( k, kw ) ) )
274 imax = izamax( k-1, w( 1, kw ), 1 )
275 colmax = cabs1( w( imax, kw ) )
280 IF( max( absakk, colmax ).EQ.zero )
THEN
287 a( k, k ) = dble( a( k, k ) )
295 IF( absakk.GE.alpha*colmax )
THEN
307 CALL zcopy( imax-1, a( 1, imax ), 1, w( 1, kw-1 ), 1 )
308 w( imax, kw-1 ) = dble( a( imax, imax ) )
309 CALL zcopy( k-imax, a( imax, imax+1 ), lda,
310 $ w( imax+1, kw-1 ), 1 )
311 CALL zlacgv( k-imax, w( imax+1, kw-1 ), 1 )
313 CALL zgemv(
'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 ) = dble( w( imax, kw-1 ) )
323 jmax = imax + izamax( k-imax, w( imax+1, kw-1 ), 1 )
324 rowmax = cabs1( w( jmax, kw-1 ) )
326 jmax = izamax( 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( dble( w( imax, kw-1 ) ) ).GE.alpha*rowmax )
348 CALL zcopy( k, w( 1, kw-1 ), 1, w( 1, kw ), 1 )
387 a( kp, kp ) = dble( a( kk, kk ) )
388 CALL zcopy( kk-1-kp, a( kp+1, kk ), 1, a( kp, kp+1 ),
390 CALL zlacgv( kk-1-kp, a( kp, kp+1 ), lda )
392 $
CALL zcopy( kp-1, a( 1, kk ), 1, a( 1, kp ), 1 )
400 $
CALL zswap( n-k, a( kk, k+1 ), lda, a( kp, k+1 ),
402 CALL zswap( n-kk+1, w( kk, kkw ), ldw, w( kp, kkw ),
406 IF( kstep.EQ.1 )
THEN
424 CALL zcopy( k, w( 1, kw ), 1, a( 1, k ), 1 )
431 r1 = one / dble( a( k, k ) )
432 CALL zdscal( k-1, r1, a( 1, k ), 1 )
436 CALL zlacgv( k-1, w( 1, kw ), 1 )
501 d11 = w( k, kw ) / dconjg( d21 )
502 d22 = w( k-1, kw-1 ) / d21
503 t = one / ( dble( d11*d22 )-one )
511 a( j, k-1 ) = d21*( d11*w( j, kw-1 )-w( j, kw ) )
512 a( j, k ) = dconjg( 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 zlacgv( k-1, w( 1, kw ), 1 )
526 CALL zlacgv( k-2, w( 1, kw-1 ), 1 )
534 IF( kstep.EQ.1 )
THEN
554 CALL zgemmtr(
'Upper',
'No transpose',
'Transpose', k, n-k,
555 $ -cone, a( 1, k+1 ), lda, w( 1, kw+1 ), ldw,
556 $ cone, a( 1, 1 ), lda )
578 IF( jp.NE.jj .AND. j.LE.n )
579 $
CALL zswap( n-j+1, a( jp, j ), lda, a( jj, j ), lda )
600 IF( ( k.GE.nb .AND. nb.LT.n ) .OR. k.GT.n )
607 w( k, k ) = dble( a( k, k ) )
609 $
CALL zcopy( n-k, a( k+1, k ), 1, w( k+1, k ), 1 )
610 CALL zgemv(
'No transpose', n-k+1, k-1, -cone, a( k, 1 ),
612 $ w( k, 1 ), ldw, cone, w( k, k ), 1 )
613 w( k, k ) = dble( w( k, k ) )
618 absakk = abs( dble( w( k, k ) ) )
625 imax = k + izamax( n-k, w( k+1, k ), 1 )
626 colmax = cabs1( w( imax, k ) )
631 IF( max( absakk, colmax ).EQ.zero )
THEN
638 a( k, k ) = dble( a( k, k ) )
646 IF( absakk.GE.alpha*colmax )
THEN
658 CALL zcopy( imax-k, a( imax, k ), lda, w( k, k+1 ),
660 CALL zlacgv( imax-k, w( k, k+1 ), 1 )
661 w( imax, k+1 ) = dble( a( imax, imax ) )
663 $
CALL zcopy( n-imax, a( imax+1, imax ), 1,
664 $ w( imax+1, k+1 ), 1 )
665 CALL zgemv(
'No transpose', n-k+1, k-1, -cone, a( k,
667 $ lda, w( imax, 1 ), ldw, cone, w( k, k+1 ),
669 w( imax, k+1 ) = dble( w( imax, k+1 ) )
675 jmax = k - 1 + izamax( imax-k, w( k, k+1 ), 1 )
676 rowmax = cabs1( w( jmax, k+1 ) )
678 jmax = imax + izamax( n-imax, w( imax+1, k+1 ), 1 )
679 rowmax = max( rowmax, cabs1( w( jmax, k+1 ) ) )
683 IF( absakk.GE.alpha*colmax*( colmax / rowmax ) )
THEN
690 ELSE IF( abs( dble( w( imax, k+1 ) ) ).GE.alpha*rowmax )
700 CALL zcopy( n-k+1, w( k, k+1 ), 1, w( k, k ), 1 )
735 a( kp, kp ) = dble( a( kk, kk ) )
736 CALL zcopy( kp-kk-1, a( kk+1, kk ), 1, a( kp, kk+1 ),
738 CALL zlacgv( kp-kk-1, a( kp, kk+1 ), lda )
740 $
CALL zcopy( n-kp, a( kp+1, kk ), 1, a( kp+1, kp ),
749 $
CALL zswap( k-1, a( kk, 1 ), lda, a( kp, 1 ), lda )
750 CALL zswap( kk, w( kk, 1 ), ldw, w( kp, 1 ), ldw )
753 IF( kstep.EQ.1 )
THEN
771 CALL zcopy( n-k+1, w( k, k ), 1, a( k, k ), 1 )
778 r1 = one / dble( a( k, k ) )
779 CALL zdscal( n-k, r1, a( k+1, k ), 1 )
783 CALL zlacgv( n-k, w( k+1, k ), 1 )
848 d11 = w( k+1, k+1 ) / d21
849 d22 = w( k, k ) / dconjg( d21 )
850 t = one / ( dble( d11*d22 )-one )
858 a( j, k ) = dconjg( d21 )*
859 $ ( d11*w( j, k )-w( j, k+1 ) )
860 a( j, k+1 ) = d21*( d22*w( j, k+1 )-w( j, k ) )
866 a( k, k ) = w( k, k )
867 a( k+1, k ) = w( k+1, k )
868 a( k+1, k+1 ) = w( k+1, k+1 )
872 CALL zlacgv( n-k, w( k+1, k ), 1 )
873 CALL zlacgv( n-k-1, w( k+2, k+1 ), 1 )
881 IF( kstep.EQ.1 )
THEN
901 CALL zgemmtr(
'Lower',
'No transpose',
'Transpose', n-k+1,
902 $ k-1, -cone, a( k, 1 ), lda, w( k, 1 ), ldw,
903 $ cone, a( k, k ), lda )
925 IF( jp.NE.jj .AND. j.GE.1 )
926 $
CALL zswap( j, a( jp, 1 ), lda, a( jj, 1 ), lda )