158 SUBROUTINE zlahef( UPLO, N, NB, KB, A, LDA, IPIV, W, LDW, INFO )
167 INTEGER info, kb, lda, ldw, n, nb
171 COMPLEX*16 a( lda, * ), w( ldw, * )
177 DOUBLE PRECISION zero, one
178 parameter( zero = 0.0d+0, one = 1.0d+0 )
180 parameter( cone = ( 1.0d+0, 0.0d+0 ) )
181 DOUBLE PRECISION eight, sevten
182 parameter( eight = 8.0d+0, sevten = 17.0d+0 )
185 INTEGER imax, j, jb, jj, jmax, jp, k, kk, kkw, kp,
187 DOUBLE PRECISION absakk, alpha, colmax, r1, rowmax, t
188 COMPLEX*16 d11, d21, d22, z
199 INTRINSIC abs, dble, dconjg, dimag, max, min, sqrt
202 DOUBLE PRECISION cabs1
205 cabs1( z ) = abs( dble( z ) ) + abs( dimag( z ) )
213 alpha = ( one+sqrt( sevten ) ) / eight
215 IF(
lsame( uplo,
'U' ) )
THEN
231 IF( ( k.LE.n-nb+1 .AND. nb.LT.n ) .OR. k.LT.1 )
236 CALL
zcopy( k-1, a( 1, k ), 1, w( 1, kw ), 1 )
237 w( k, kw ) = dble( a( k, k ) )
239 CALL
zgemv(
'No transpose', k, n-k, -cone, a( 1, k+1 ), lda,
240 $ w( k, kw+1 ), ldw, cone, w( 1, kw ), 1 )
241 w( k, kw ) = dble( w( k, kw ) )
249 absakk = abs( dble( w( k, kw ) ) )
255 imax =
izamax( k-1, w( 1, kw ), 1 )
256 colmax = cabs1( w( imax, kw ) )
261 IF( max( absakk, colmax ).EQ.zero )
THEN
268 a( k, k ) = dble( a( k, k ) )
270 IF( absakk.GE.alpha*colmax )
THEN
279 CALL
zcopy( imax-1, a( 1, imax ), 1, w( 1, kw-1 ), 1 )
280 w( imax, kw-1 ) = dble( a( imax, imax ) )
281 CALL
zcopy( k-imax, a( imax, imax+1 ), lda,
282 $ w( imax+1, kw-1 ), 1 )
283 CALL
zlacgv( k-imax, w( imax+1, kw-1 ), 1 )
285 CALL
zgemv(
'No transpose', k, n-k, -cone,
286 $ a( 1, k+1 ), lda, w( imax, kw+1 ), ldw,
287 $ cone, w( 1, kw-1 ), 1 )
288 w( imax, kw-1 ) = dble( w( imax, kw-1 ) )
294 jmax = imax +
izamax( k-imax, w( imax+1, kw-1 ), 1 )
295 rowmax = cabs1( w( jmax, kw-1 ) )
297 jmax =
izamax( imax-1, w( 1, kw-1 ), 1 )
298 rowmax = max( rowmax, cabs1( w( jmax, kw-1 ) ) )
301 IF( absakk.GE.alpha*colmax*( colmax / rowmax ) )
THEN
306 ELSE IF( abs( dble( w( imax, kw-1 ) ) ).GE.alpha*rowmax )
316 CALL
zcopy( k, w( 1, kw-1 ), 1, w( 1, kw ), 1 )
336 a( kp, kp ) = dble( a( kk, kk ) )
337 CALL
zcopy( kk-1-kp, a( kp+1, kk ), 1, a( kp, kp+1 ),
339 CALL
zlacgv( kk-1-kp, a( kp, kp+1 ), lda )
340 CALL
zcopy( kp-1, a( 1, kk ), 1, a( 1, kp ), 1 )
345 $ CALL
zswap( n-kk, a( kk, kk+1 ), lda, a( kp, kk+1 ),
347 CALL
zswap( n-kk+1, w( kk, kkw ), ldw, w( kp, kkw ),
351 IF( kstep.EQ.1 )
THEN
361 CALL
zcopy( k, w( 1, kw ), 1, a( 1, k ), 1 )
362 r1 = one / dble( a( k, k ) )
363 CALL
zdscal( k-1, r1, a( 1, k ), 1 )
367 CALL
zlacgv( k-1, w( 1, kw ), 1 )
383 d11 = w( k, kw ) / dconjg( d21 )
384 d22 = w( k-1, kw-1 ) / d21
385 t = one / ( dble( d11*d22 )-one )
388 a( j, k-1 ) = d21*( d11*w( j, kw-1 )-w( j, kw ) )
389 a( j, k ) = dconjg( d21 )*
390 $ ( d22*w( j, kw )-w( j, kw-1 ) )
396 a( k-1, k-1 ) = w( k-1, kw-1 )
397 a( k-1, k ) = w( k-1, kw )
398 a( k, k ) = w( k, kw )
402 CALL
zlacgv( k-1, w( 1, kw ), 1 )
403 CALL
zlacgv( k-2, w( 1, kw-1 ), 1 )
409 IF( kstep.EQ.1 )
THEN
430 DO 50 j = ( ( k-1 ) / nb )*nb + 1, 1, -nb
431 jb = min( nb, k-j+1 )
435 DO 40 jj = j, j + jb - 1
436 a( jj, jj ) = dble( a( jj, jj ) )
437 CALL
zgemv(
'No transpose', jj-j+1, n-k, -cone,
438 $ a( j, k+1 ), lda, w( jj, kw+1 ), ldw, cone,
440 a( jj, jj ) = dble( a( jj, jj ) )
445 CALL
zgemm(
'No transpose',
'Transpose', j-1, jb, n-k,
446 $ -cone, a( 1, k+1 ), lda, w( j, kw+1 ), ldw,
447 $ cone, a( 1, j ), lda )
462 IF( jp.NE.jj .AND. j.LE.n )
463 $ CALL
zswap( n-j+1, a( jp, j ), lda, a( jj, j ), lda )
484 IF( ( k.GE.nb .AND. nb.LT.n ) .OR. k.GT.n )
489 w( k, k ) = dble( a( k, k ) )
491 $ CALL
zcopy( n-k, a( k+1, k ), 1, w( k+1, k ), 1 )
492 CALL
zgemv(
'No transpose', n-k+1, k-1, -cone, a( k, 1 ), lda,
493 $ w( k, 1 ), ldw, cone, w( k, k ), 1 )
494 w( k, k ) = dble( w( k, k ) )
501 absakk = abs( dble( w( k, k ) ) )
507 imax = k +
izamax( n-k, w( k+1, k ), 1 )
508 colmax = cabs1( w( imax, k ) )
513 IF( max( absakk, colmax ).EQ.zero )
THEN
520 a( k, k ) = dble( a( k, k ) )
522 IF( absakk.GE.alpha*colmax )
THEN
531 CALL
zcopy( imax-k, a( imax, k ), lda, w( k, k+1 ), 1 )
532 CALL
zlacgv( imax-k, w( k, k+1 ), 1 )
533 w( imax, k+1 ) = dble( a( imax, imax ) )
535 $ CALL
zcopy( n-imax, a( imax+1, imax ), 1,
536 $ w( imax+1, k+1 ), 1 )
537 CALL
zgemv(
'No transpose', n-k+1, k-1, -cone, a( k, 1 ),
538 $ lda, w( imax, 1 ), ldw, cone, w( k, k+1 ),
540 w( imax, k+1 ) = dble( w( imax, k+1 ) )
545 jmax = k - 1 +
izamax( imax-k, w( k, k+1 ), 1 )
546 rowmax = cabs1( w( jmax, k+1 ) )
548 jmax = imax +
izamax( n-imax, w( imax+1, k+1 ), 1 )
549 rowmax = max( rowmax, cabs1( w( jmax, k+1 ) ) )
552 IF( absakk.GE.alpha*colmax*( colmax / rowmax ) )
THEN
557 ELSE IF( abs( dble( w( imax, k+1 ) ) ).GE.alpha*rowmax )
567 CALL
zcopy( n-k+1, w( k, k+1 ), 1, w( k, k ), 1 )
586 a( kp, kp ) = dble( a( kk, kk ) )
587 CALL
zcopy( kp-kk-1, a( kk+1, kk ), 1, a( kp, kk+1 ),
589 CALL
zlacgv( kp-kk-1, a( kp, kk+1 ), lda )
591 $ CALL
zcopy( n-kp, a( kp+1, kk ), 1, a( kp+1, kp ), 1 )
595 CALL
zswap( kk-1, a( kk, 1 ), lda, a( kp, 1 ), lda )
596 CALL
zswap( kk, w( kk, 1 ), ldw, w( kp, 1 ), ldw )
599 IF( kstep.EQ.1 )
THEN
609 CALL
zcopy( n-k+1, w( k, k ), 1, a( k, k ), 1 )
611 r1 = one / dble( a( k, k ) )
612 CALL
zdscal( n-k, r1, a( k+1, k ), 1 )
616 CALL
zlacgv( n-k, w( k+1, k ), 1 )
632 d11 = w( k+1, k+1 ) / d21
633 d22 = w( k, k ) / dconjg( d21 )
634 t = one / ( dble( d11*d22 )-one )
637 a( j, k ) = dconjg( d21 )*
638 $ ( d11*w( j, k )-w( j, k+1 ) )
639 a( j, k+1 ) = d21*( d22*w( j, k+1 )-w( j, k ) )
645 a( k, k ) = w( k, k )
646 a( k+1, k ) = w( k+1, k )
647 a( k+1, k+1 ) = w( k+1, k+1 )
651 CALL
zlacgv( n-k, w( k+1, k ), 1 )
652 CALL
zlacgv( n-k-1, w( k+2, k+1 ), 1 )
658 IF( kstep.EQ.1 )
THEN
680 jb = min( nb, n-j+1 )
684 DO 100 jj = j, j + jb - 1
685 a( jj, jj ) = dble( a( jj, jj ) )
686 CALL
zgemv(
'No transpose', j+jb-jj, k-1, -cone,
687 $ a( jj, 1 ), lda, w( jj, 1 ), ldw, cone,
689 a( jj, jj ) = dble( a( jj, jj ) )
695 $ CALL
zgemm(
'No transpose',
'Transpose', n-j-jb+1, jb,
696 $ k-1, -cone, a( j+jb, 1 ), lda, w( j, 1 ),
697 $ ldw, cone, a( j+jb, j ), lda )
712 IF( jp.NE.jj .AND. j.GE.1 )
713 $ CALL
zswap( j, a( jp, 1 ), lda, a( jj, 1 ), lda )