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 )
202 parameter( cone = ( 1.0d+0, 0.0d+0 ) )
203 DOUBLE PRECISION EIGHT, SEVTEN
204 parameter( eight = 8.0d+0, sevten = 17.0d+0 )
208 INTEGER IMAX, ITEMP, II, J, JB, JJ, JMAX, JP1, JP2, K,
209 $ kk, kkw, kp, kstep, kw, p
210 DOUBLE PRECISION ABSAKK, ALPHA, COLMAX, DTEMP, R1, ROWMAX, T,
212 COMPLEX*16 D11, D21, D22, Z
217 DOUBLE PRECISION DLAMCH
218 EXTERNAL lsame, izamax, dlamch
225 INTRINSIC abs, dble, dconjg, dimag, max, min, sqrt
228 DOUBLE PRECISION CABS1
231 cabs1( z ) = abs( dble( z ) ) + abs( dimag( z ) )
239 alpha = ( one+sqrt( sevten ) ) / eight
243 sfmin = dlamch(
'S' )
245 IF( lsame( uplo,
'U' ) )
THEN
262 IF( ( k.LE.n-nb+1 .AND. nb.LT.n ) .OR. k.LT.1 )
271 $
CALL zcopy( k-1, a( 1, k ), 1, w( 1, kw ), 1 )
272 w( k, kw ) = dble( a( k, k ) )
274 CALL zgemv(
'No transpose', k, n-k, -cone, a( 1, k+1 ),
276 $ w( k, kw+1 ), ldw, cone, w( 1, kw ), 1 )
277 w( k, kw ) = dble( w( k, kw ) )
283 absakk = abs( dble( w( k, kw ) ) )
290 imax = izamax( k-1, w( 1, kw ), 1 )
291 colmax = cabs1( w( imax, kw ) )
296 IF( max( absakk, colmax ).EQ.zero )
THEN
303 a( k, k ) = dble( w( k, kw ) )
305 $
CALL zcopy( k-1, w( 1, kw ), 1, a( 1, k ), 1 )
315 IF( .NOT.( absakk.LT.alpha*colmax ) )
THEN
335 $
CALL zcopy( imax-1, a( 1, imax ), 1, w( 1,
338 w( imax, kw-1 ) = dble( a( imax, imax ) )
340 CALL zcopy( k-imax, a( imax, imax+1 ), lda,
341 $ w( imax+1, kw-1 ), 1 )
342 CALL zlacgv( k-imax, w( imax+1, kw-1 ), 1 )
345 CALL zgemv(
'No transpose', k, n-k, -cone,
346 $ a( 1, k+1 ), lda, w( imax, kw+1 ), ldw,
347 $ cone, w( 1, kw-1 ), 1 )
348 w( imax, kw-1 ) = dble( w( imax, kw-1 ) )
356 jmax = imax + izamax( k-imax, w( imax+1, kw-1 ),
358 rowmax = cabs1( w( jmax, kw-1 ) )
364 itemp = izamax( imax-1, w( 1, kw-1 ), 1 )
365 dtemp = cabs1( w( itemp, kw-1 ) )
366 IF( dtemp.GT.rowmax )
THEN
377 IF( .NOT.( abs( dble( w( imax,kw-1 ) ) )
378 $ .LT.alpha*rowmax ) )
THEN
387 CALL zcopy( k, w( 1, kw-1 ), 1, w( 1, kw ), 1 )
395 ELSE IF( ( p.EQ.jmax ) .OR. ( rowmax.LE.colmax ) )
416 CALL zcopy( k, w( 1, kw-1 ), 1, w( 1, kw ), 1 )
423 IF( .NOT.done )
GOTO 12
442 IF( ( kstep.EQ.2 ) .AND. ( p.NE.k ) )
THEN
449 a( p, p ) = dble( a( k, k ) )
450 CALL zcopy( k-1-p, a( p+1, k ), 1, a( p, p+1 ),
452 CALL zlacgv( k-1-p, a( p, p+1 ), lda )
454 $
CALL zcopy( p-1, a( 1, k ), 1, a( 1, p ), 1 )
462 $
CALL zswap( n-k, a( k, k+1 ), lda, a( p, k+1 ),
464 CALL zswap( n-kk+1, w( k, kkw ), ldw, w( p, kkw ),
478 a( kp, kp ) = dble( a( kk, kk ) )
479 CALL zcopy( kk-1-kp, a( kp+1, kk ), 1, a( kp, kp+1 ),
481 CALL zlacgv( kk-1-kp, a( kp, kp+1 ), lda )
483 $
CALL zcopy( kp-1, a( 1, kk ), 1, a( 1, kp ), 1 )
491 $
CALL zswap( n-k, a( kk, k+1 ), lda, a( kp, k+1 ),
493 CALL zswap( n-kk+1, w( kk, kkw ), ldw, w( kp, kkw ),
497 IF( kstep.EQ.1 )
THEN
515 CALL zcopy( k, w( 1, kw ), 1, a( 1, k ), 1 )
524 t = dble( a( k, k ) )
525 IF( abs( t ).GE.sfmin )
THEN
527 CALL zdscal( k-1, r1, a( 1, k ), 1 )
530 a( ii, k ) = a( ii, k ) / t
536 CALL zlacgv( k-1, w( 1, kw ), 1 )
604 d11 = w( k, kw ) / dconjg( d21 )
605 d22 = w( k-1, kw-1 ) / d21
606 t = one / ( dble( d11*d22 )-one )
613 a( j, k-1 ) = t*( ( d11*w( j, kw-1 )-w( j, kw ) ) /
615 a( j, k ) = t*( ( d22*w( j, kw )-w( j, kw-1 ) ) /
622 a( k-1, k-1 ) = w( k-1, kw-1 )
623 a( k-1, k ) = w( k-1, kw )
624 a( k, k ) = w( k, kw )
628 CALL zlacgv( k-1, w( 1, kw ), 1 )
629 CALL zlacgv( k-2, w( 1, kw-1 ), 1 )
637 IF( kstep.EQ.1 )
THEN
658 DO 50 j = ( ( k-1 ) / nb )*nb + 1, 1, -nb
659 jb = min( nb, k-j+1 )
663 DO 40 jj = j, j + jb - 1
664 a( jj, jj ) = dble( a( jj, jj ) )
665 CALL zgemv(
'No transpose', jj-j+1, n-k, -cone,
666 $ a( j, k+1 ), lda, w( jj, kw+1 ), ldw, cone,
668 a( jj, jj ) = dble( a( jj, jj ) )
674 $
CALL zgemm(
'No transpose',
'Transpose', j-1, jb, n-k,
675 $ -cone, a( 1, k+1 ), lda, w( j, kw+1 ), ldw,
676 $ cone, a( 1, j ), lda )
703 IF( jp2.NE.jj .AND. j.LE.n )
704 $
CALL zswap( n-j+1, a( jp2, j ), lda, a( jj, j ), lda )
706 IF( kstep.EQ.2 .AND. jp1.NE.jj .AND. j.LE.n )
707 $
CALL zswap( n-j+1, a( jp1, j ), lda, a( jj, j ), lda )
728 IF( ( k.GE.nb .AND. nb.LT.n ) .OR. k.GT.n )
736 w( k, k ) = dble( a( k, k ) )
738 $
CALL zcopy( n-k, a( k+1, k ), 1, w( k+1, k ), 1 )
740 CALL zgemv(
'No transpose', n-k+1, k-1, -cone, a( k, 1 ),
741 $ lda, w( k, 1 ), ldw, cone, w( k, k ), 1 )
742 w( k, k ) = dble( w( k, k ) )
748 absakk = abs( dble( w( k, k ) ) )
755 imax = k + izamax( n-k, w( k+1, k ), 1 )
756 colmax = cabs1( w( imax, k ) )
761 IF( max( absakk, colmax ).EQ.zero )
THEN
768 a( k, k ) = dble( w( k, k ) )
770 $
CALL zcopy( n-k, w( k+1, k ), 1, a( k+1, k ), 1 )
781 IF( .NOT.( absakk.LT.alpha*colmax ) )
THEN
800 CALL zcopy( imax-k, a( imax, k ), lda, w( k, k+1 ),
802 CALL zlacgv( imax-k, w( k, k+1 ), 1 )
803 w( imax, k+1 ) = dble( a( imax, imax ) )
806 $
CALL zcopy( n-imax, a( imax+1, imax ), 1,
807 $ w( imax+1, k+1 ), 1 )
810 CALL zgemv(
'No transpose', n-k+1, k-1, -cone,
811 $ a( k, 1 ), lda, w( imax, 1 ), ldw,
812 $ cone, w( k, k+1 ), 1 )
813 w( imax, k+1 ) = dble( w( imax, k+1 ) )
821 jmax = k - 1 + izamax( imax-k, w( k, k+1 ), 1 )
822 rowmax = cabs1( w( jmax, k+1 ) )
828 itemp = imax + izamax( n-imax, w( imax+1, k+1 ),
830 dtemp = cabs1( w( itemp, k+1 ) )
831 IF( dtemp.GT.rowmax )
THEN
842 IF( .NOT.( abs( dble( w( imax,k+1 ) ) )
843 $ .LT.alpha*rowmax ) )
THEN
852 CALL zcopy( n-k+1, w( k, k+1 ), 1, w( k, k ),
861 ELSE IF( ( p.EQ.jmax ) .OR. ( rowmax.LE.colmax ) )
882 CALL zcopy( n-k+1, w( k, k+1 ), 1, w( k, k ),
890 IF( .NOT.done )
GOTO 72
905 IF( ( kstep.EQ.2 ) .AND. ( p.NE.k ) )
THEN
912 a( p, p ) = dble( a( k, k ) )
913 CALL zcopy( p-k-1, a( k+1, k ), 1, a( p, k+1 ), lda )
914 CALL zlacgv( p-k-1, a( p, k+1 ), lda )
916 $
CALL zcopy( n-p, a( p+1, k ), 1, a( p+1, p ), 1 )
924 $
CALL zswap( k-1, a( k, 1 ), lda, a( p, 1 ), lda )
925 CALL zswap( kk, w( k, 1 ), ldw, w( p, 1 ), ldw )
938 a( kp, kp ) = dble( a( kk, kk ) )
939 CALL zcopy( kp-kk-1, a( kk+1, kk ), 1, a( kp, kk+1 ),
941 CALL zlacgv( kp-kk-1, a( kp, kk+1 ), lda )
943 $
CALL zcopy( n-kp, a( kp+1, kk ), 1, a( kp+1, kp ),
952 $
CALL zswap( k-1, a( kk, 1 ), lda, a( kp, 1 ), lda )
953 CALL zswap( kk, w( kk, 1 ), ldw, w( kp, 1 ), ldw )
956 IF( kstep.EQ.1 )
THEN
974 CALL zcopy( n-k+1, w( k, k ), 1, a( k, k ), 1 )
983 t = dble( a( k, k ) )
984 IF( abs( t ).GE.sfmin )
THEN
986 CALL zdscal( n-k, r1, a( k+1, k ), 1 )
989 a( ii, k ) = a( ii, k ) / t
995 CALL zlacgv( n-k, w( k+1, k ), 1 )
1063 d11 = w( k+1, k+1 ) / d21
1064 d22 = w( k, k ) / dconjg( d21 )
1065 t = one / ( dble( d11*d22 )-one )
1072 a( j, k ) = t*( ( d11*w( j, k )-w( j, k+1 ) ) /
1074 a( j, k+1 ) = t*( ( d22*w( j, k+1 )-w( j, k ) ) /
1081 a( k, k ) = w( k, k )
1082 a( k+1, k ) = w( k+1, k )
1083 a( k+1, k+1 ) = w( k+1, k+1 )
1087 CALL zlacgv( n-k, w( k+1, k ), 1 )
1088 CALL zlacgv( n-k-1, w( k+2, k+1 ), 1 )
1096 IF( kstep.EQ.1 )
THEN
1118 jb = min( nb, n-j+1 )
1122 DO 100 jj = j, j + jb - 1
1123 a( jj, jj ) = dble( a( jj, jj ) )
1124 CALL zgemv(
'No transpose', j+jb-jj, k-1, -cone,
1125 $ a( jj, 1 ), lda, w( jj, 1 ), ldw, cone,
1127 a( jj, jj ) = dble( a( jj, jj ) )
1133 $
CALL zgemm(
'No transpose',
'Transpose', n-j-jb+1, jb,
1134 $ k-1, -cone, a( j+jb, 1 ), lda, w( j, 1 ),
1135 $ ldw, cone, a( j+jb, j ), lda )
1162 IF( jp2.NE.jj .AND. j.GE.1 )
1163 $
CALL zswap( j, a( jp2, 1 ), lda, a( jj, 1 ), lda )
1165 IF( kstep.EQ.2 .AND. jp1.NE.jj .AND. j.GE.1 )
1166 $
CALL zswap( j, a( jp1, 1 ), lda, a( jj, 1 ), lda )