189 INTEGER INFO, KB, LDA, LDW, N, NB
193 COMPLEX*16 A( LDA, * ), W( LDW, * )
199 DOUBLE PRECISION ZERO, ONE
200 parameter( zero = 0.0d+0, one = 1.0d+0 )
201 DOUBLE PRECISION EIGHT, SEVTEN
202 parameter( eight = 8.0d+0, sevten = 17.0d+0 )
203 COMPLEX*16 CONE, CZERO
204 parameter( cone = ( 1.0d+0, 0.0d+0 ),
205 $ czero = ( 0.0d+0, 0.0d+0 ) )
209 INTEGER IMAX, ITEMP, J, JJ, JMAX, JP1, JP2, K, KK,
210 $ kw, kkw, kp, kstep, p, ii
211 DOUBLE PRECISION ABSAKK, ALPHA, COLMAX, ROWMAX, DTEMP, SFMIN
212 COMPLEX*16 D11, D12, D21, D22, R1, T, Z
217 DOUBLE PRECISION DLAMCH
218 EXTERNAL lsame, izamax, dlamch
224 INTRINSIC abs, max, min, sqrt, dimag, dble
227 DOUBLE PRECISION CABS1
230 cabs1( z ) = abs( dble( z ) ) + abs( dimag( z ) )
238 alpha = ( one+sqrt( sevten ) ) / eight
242 sfmin = dlamch(
'S' )
244 IF( lsame( uplo,
'U' ) )
THEN
261 IF( ( k.LE.n-nb+1 .AND. nb.LT.n ) .OR. k.LT.1 )
269 CALL zcopy( k, a( 1, k ), 1, w( 1, kw ), 1 )
271 $
CALL zgemv(
'No transpose', k, n-k, -cone, a( 1, k+1 ),
272 $ lda, w( k, kw+1 ), ldw, cone, w( 1, kw ), 1 )
277 absakk = cabs1( w( k, kw ) )
284 imax = izamax( k-1, w( 1, kw ), 1 )
285 colmax = cabs1( w( imax, kw ) )
290 IF( max( absakk, colmax ).EQ.zero )
THEN
297 CALL zcopy( k, w( 1, kw ), 1, a( 1, k ), 1 )
307 IF( .NOT.( absakk.LT.alpha*colmax ) )
THEN
326 CALL zcopy( imax, a( 1, imax ), 1, w( 1, kw-1 ),
328 CALL zcopy( k-imax, a( imax, imax+1 ), lda,
329 $ w( imax+1, kw-1 ), 1 )
332 $
CALL zgemv(
'No transpose', k, n-k, -cone,
333 $ a( 1, k+1 ), lda, w( imax, kw+1 ), ldw,
334 $ cone, w( 1, kw-1 ), 1 )
341 jmax = imax + izamax( k-imax, w( imax+1, kw-1 ),
343 rowmax = cabs1( w( jmax, kw-1 ) )
349 itemp = izamax( imax-1, w( 1, kw-1 ), 1 )
350 dtemp = cabs1( w( itemp, kw-1 ) )
351 IF( dtemp.GT.rowmax )
THEN
361 IF( .NOT.(cabs1( w( imax, kw-1 ) ).LT.alpha*rowmax ) )
371 CALL zcopy( k, w( 1, kw-1 ), 1, w( 1, kw ), 1 )
378 ELSE IF( ( p.EQ.jmax ) .OR. ( rowmax.LE.colmax ) )
397 CALL zcopy( k, w( 1, kw-1 ), 1, w( 1, kw ), 1 )
403 IF( .NOT. done )
GOTO 12
415 IF( ( kstep.EQ.2 ) .AND. ( p.NE.k ) )
THEN
419 CALL zcopy( k-p, a( p+1, k ), 1, a( p, p+1 ), lda )
420 CALL zcopy( p, a( 1, k ), 1, a( 1, p ), 1 )
425 CALL zswap( n-k+1, a( k, k ), lda, a( p, k ), lda )
426 CALL zswap( n-kk+1, w( k, kkw ), ldw, w( p, kkw ),
436 a( kp, k ) = a( kk, k )
437 CALL zcopy( k-1-kp, a( kp+1, kk ), 1, a( kp, kp+1 ),
439 CALL zcopy( kp, a( 1, kk ), 1, a( 1, kp ), 1 )
444 CALL zswap( n-kk+1, a( kk, kk ), lda, a( kp, kk ),
446 CALL zswap( n-kk+1, w( kk, kkw ), ldw, w( kp, kkw ),
450 IF( kstep.EQ.1 )
THEN
460 CALL zcopy( k, w( 1, kw ), 1, a( 1, k ), 1 )
462 IF( cabs1( a( k, k ) ).GE.sfmin )
THEN
463 r1 = cone / a( k, k )
464 CALL zscal( k-1, r1, a( 1, k ), 1 )
465 ELSE IF( a( k, k ).NE.czero )
THEN
467 a( ii, k ) = a( ii, k ) / a( k, k )
487 d11 = w( k, kw ) / d12
488 d22 = w( k-1, kw-1 ) / d12
489 t = cone / ( d11*d22-cone )
491 a( j, k-1 ) = t*( (d11*w( j, kw-1 )-w( j, kw ) ) /
493 a( j, k ) = t*( ( d22*w( j, kw )-w( j, kw-1 ) ) /
500 a( k-1, k-1 ) = w( k-1, kw-1 )
501 a( k-1, k ) = w( k-1, kw )
502 a( k, k ) = w( k, kw )
508 IF( kstep.EQ.1 )
THEN
528 CALL zgemmtr(
'Upper',
'No transpose',
'Transpose', k, n-k,
529 $ -cone, a( 1, k+1 ), lda, w( 1, kw+1 ), ldw,
530 $ cone, a( 1, 1 ), lda )
550 IF( jp2.NE.jj .AND. j.LE.n )
551 $
CALL zswap( n-j+1, a( jp2, j ), lda, a( jj, j ), lda )
553 IF( jp1.NE.jj .AND. kstep.EQ.2 )
554 $
CALL zswap( n-j+1, a( jp1, j ), lda, a( jj, j ), lda )
575 IF( ( k.GE.nb .AND. nb.LT.n ) .OR. k.GT.n )
583 CALL zcopy( n-k+1, a( k, k ), 1, w( k, k ), 1 )
585 $
CALL zgemv(
'No transpose', n-k+1, k-1, -cone, a( k, 1 ),
586 $ lda, w( k, 1 ), ldw, cone, w( k, k ), 1 )
591 absakk = cabs1( w( k, k ) )
598 imax = k + izamax( n-k, w( k+1, k ), 1 )
599 colmax = cabs1( w( imax, k ) )
604 IF( max( absakk, colmax ).EQ.zero )
THEN
611 CALL zcopy( n-k+1, w( k, k ), 1, a( k, k ), 1 )
621 IF( .NOT.( absakk.LT.alpha*colmax ) )
THEN
640 CALL zcopy( imax-k, a( imax, k ), lda, w( k, k+1 ),
642 CALL zcopy( n-imax+1, a( imax, imax ), 1,
643 $ w( imax, k+1 ), 1 )
645 $
CALL zgemv(
'No transpose', n-k+1, k-1, -cone,
646 $ a( k, 1 ), lda, w( imax, 1 ), ldw,
647 $ cone, w( k, k+1 ), 1 )
654 jmax = k - 1 + izamax( imax-k, w( k, k+1 ), 1 )
655 rowmax = cabs1( w( jmax, k+1 ) )
661 itemp = imax + izamax( n-imax, w( imax+1, k+1 ),
663 dtemp = cabs1( w( itemp, k+1 ) )
664 IF( dtemp.GT.rowmax )
THEN
674 IF( .NOT.( cabs1( w( imax, k+1 ) ).LT.alpha*rowmax ) )
684 CALL zcopy( n-k+1, w( k, k+1 ), 1, w( k, k ),
692 ELSE IF( ( p.EQ.jmax ) .OR. ( rowmax.LE.colmax ) )
711 CALL zcopy( n-k+1, w( k, k+1 ), 1, w( k, k ),
718 IF( .NOT. done )
GOTO 72
726 IF( ( kstep.EQ.2 ) .AND. ( p.NE.k ) )
THEN
730 CALL zcopy( p-k, a( k, k ), 1, a( p, k ), lda )
731 CALL zcopy( n-p+1, a( p, k ), 1, a( p, p ), 1 )
736 CALL zswap( k, a( k, 1 ), lda, a( p, 1 ), lda )
737 CALL zswap( kk, w( k, 1 ), ldw, w( p, 1 ), ldw )
746 a( kp, k ) = a( kk, k )
747 CALL zcopy( kp-k-1, a( k+1, kk ), 1, a( kp, k+1 ),
749 CALL zcopy( n-kp+1, a( kp, kk ), 1, a( kp, kp ), 1 )
753 CALL zswap( kk, a( kk, 1 ), lda, a( kp, 1 ), lda )
754 CALL zswap( kk, w( kk, 1 ), ldw, w( kp, 1 ), ldw )
757 IF( kstep.EQ.1 )
THEN
767 CALL zcopy( n-k+1, w( k, k ), 1, a( k, k ), 1 )
769 IF( cabs1( a( k, k ) ).GE.sfmin )
THEN
770 r1 = cone / a( k, k )
771 CALL zscal( n-k, r1, a( k+1, k ), 1 )
772 ELSE IF( a( k, k ).NE.czero )
THEN
774 a( ii, k ) = a( ii, k ) / a( k, k )
793 d11 = w( k+1, k+1 ) / d21
794 d22 = w( k, k ) / d21
795 t = cone / ( d11*d22-cone )
797 a( j, k ) = t*( ( d11*w( j, k )-w( j, k+1 ) ) /
799 a( j, k+1 ) = t*( ( d22*w( j, k+1 )-w( j, k ) ) /
806 a( k, k ) = w( k, k )
807 a( k+1, k ) = w( k+1, k )
808 a( k+1, k+1 ) = w( k+1, k+1 )
814 IF( kstep.EQ.1 )
THEN
834 CALL zgemmtr(
'Lower',
'No transpose',
'Transpose', n-k+1,
835 $ k-1, -cone, a( k, 1 ), lda, w( k, 1 ), ldw,
836 $ cone, a( k, k ), lda )
856 IF( jp2.NE.jj .AND. j.GE.1 )
857 $
CALL zswap( j, a( jp2, 1 ), lda, a( jj, 1 ), lda )
859 IF( jp1.NE.jj .AND. kstep.EQ.2 )
860 $
CALL zswap( j, a( jp1, 1 ), lda, a( jj, 1 ), lda )