189 INTEGER INFO, KB, LDA, LDW, N, NB
193 COMPLEX A( LDA, * ), W( LDW, * )
200 parameter( zero = 0.0e+0, one = 1.0e+0 )
202 parameter( cone = ( 1.0e+0, 0.0e+0 ) )
204 parameter( eight = 8.0e+0, sevten = 17.0e+0 )
208 INTEGER IMAX, ITEMP, II, J, JB, JJ, JMAX, JP1, JP2, K,
209 $ kk, kkw, kp, kstep, kw, p
210 REAL ABSAKK, ALPHA, COLMAX, STEMP, R1, ROWMAX, T,
212 COMPLEX D11, D21, D22, Z
218 EXTERNAL lsame, icamax, slamch
225 INTRINSIC abs, conjg, aimag, max, min, real, sqrt
231 cabs1( z ) = abs( real( z ) ) + abs( aimag( z ) )
239 alpha = ( one+sqrt( sevten ) ) / eight
243 sfmin = slamch(
'S' )
245 IF( lsame( uplo,
'U' ) )
THEN
262 IF( ( k.LE.n-nb+1 .AND. nb.LT.n ) .OR. k.LT.1 )
271 $
CALL ccopy( k-1, a( 1, k ), 1, w( 1, kw ), 1 )
272 w( k, kw ) = real( a( k, k ) )
274 CALL cgemv(
'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 ) = real( w( k, kw ) )
283 absakk = abs( real( w( k, kw ) ) )
290 imax = icamax( k-1, w( 1, kw ), 1 )
291 colmax = cabs1( w( imax, kw ) )
296 IF( max( absakk, colmax ).EQ.zero )
THEN
303 a( k, k ) = real( w( k, kw ) )
305 $
CALL ccopy( k-1, w( 1, kw ), 1, a( 1, k ), 1 )
315 IF( .NOT.( absakk.LT.alpha*colmax ) )
THEN
335 $
CALL ccopy( imax-1, a( 1, imax ), 1, w( 1,
338 w( imax, kw-1 ) = real( a( imax, imax ) )
340 CALL ccopy( k-imax, a( imax, imax+1 ), lda,
341 $ w( imax+1, kw-1 ), 1 )
342 CALL clacgv( k-imax, w( imax+1, kw-1 ), 1 )
345 CALL cgemv(
'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 ) = real( w( imax, kw-1 ) )
356 jmax = imax + icamax( k-imax, w( imax+1, kw-1 ),
358 rowmax = cabs1( w( jmax, kw-1 ) )
364 itemp = icamax( imax-1, w( 1, kw-1 ), 1 )
365 stemp = cabs1( w( itemp, kw-1 ) )
366 IF( stemp.GT.rowmax )
THEN
377 IF( .NOT.( abs( real( w( imax,kw-1 ) ) )
378 $ .LT.alpha*rowmax ) )
THEN
387 CALL ccopy( k, w( 1, kw-1 ), 1, w( 1, kw ), 1 )
395 ELSE IF( ( p.EQ.jmax ) .OR. ( rowmax.LE.colmax ) )
416 CALL ccopy( 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 ) = real( a( k, k ) )
450 CALL ccopy( k-1-p, a( p+1, k ), 1, a( p, p+1 ),
452 CALL clacgv( k-1-p, a( p, p+1 ), lda )
454 $
CALL ccopy( p-1, a( 1, k ), 1, a( 1, p ), 1 )
462 $
CALL cswap( n-k, a( k, k+1 ), lda, a( p, k+1 ),
464 CALL cswap( n-kk+1, w( k, kkw ), ldw, w( p, kkw ),
478 a( kp, kp ) = real( a( kk, kk ) )
479 CALL ccopy( kk-1-kp, a( kp+1, kk ), 1, a( kp, kp+1 ),
481 CALL clacgv( kk-1-kp, a( kp, kp+1 ), lda )
483 $
CALL ccopy( kp-1, a( 1, kk ), 1, a( 1, kp ), 1 )
491 $
CALL cswap( n-k, a( kk, k+1 ), lda, a( kp, k+1 ),
493 CALL cswap( n-kk+1, w( kk, kkw ), ldw, w( kp, kkw ),
497 IF( kstep.EQ.1 )
THEN
515 CALL ccopy( k, w( 1, kw ), 1, a( 1, k ), 1 )
524 t = real( a( k, k ) )
525 IF( abs( t ).GE.sfmin )
THEN
527 CALL csscal( k-1, r1, a( 1, k ), 1 )
530 a( ii, k ) = a( ii, k ) / t
536 CALL clacgv( k-1, w( 1, kw ), 1 )
604 d11 = w( k, kw ) / conjg( d21 )
605 d22 = w( k-1, kw-1 ) / d21
606 t = one / ( real( 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 clacgv( k-1, w( 1, kw ), 1 )
629 CALL clacgv( 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 ) = real( a( jj, jj ) )
665 CALL cgemv(
'No transpose', jj-j+1, n-k, -cone,
666 $ a( j, k+1 ), lda, w( jj, kw+1 ), ldw, cone,
668 a( jj, jj ) = real( a( jj, jj ) )
674 $
CALL cgemm(
'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 cswap( 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 cswap( 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 ) = real( a( k, k ) )
738 $
CALL ccopy( n-k, a( k+1, k ), 1, w( k+1, k ), 1 )
740 CALL cgemv(
'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 ) = real( w( k, k ) )
748 absakk = abs( real( w( k, k ) ) )
755 imax = k + icamax( 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 ) = real( w( k, k ) )
770 $
CALL ccopy( n-k, w( k+1, k ), 1, a( k+1, k ), 1 )
781 IF( .NOT.( absakk.LT.alpha*colmax ) )
THEN
800 CALL ccopy( imax-k, a( imax, k ), lda, w( k, k+1 ),
802 CALL clacgv( imax-k, w( k, k+1 ), 1 )
803 w( imax, k+1 ) = real( a( imax, imax ) )
806 $
CALL ccopy( n-imax, a( imax+1, imax ), 1,
807 $ w( imax+1, k+1 ), 1 )
810 CALL cgemv(
'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 ) = real( w( imax, k+1 ) )
821 jmax = k - 1 + icamax( imax-k, w( k, k+1 ), 1 )
822 rowmax = cabs1( w( jmax, k+1 ) )
828 itemp = imax + icamax( n-imax, w( imax+1, k+1 ),
830 stemp = cabs1( w( itemp, k+1 ) )
831 IF( stemp.GT.rowmax )
THEN
842 IF( .NOT.( abs( real( w( imax,k+1 ) ) )
843 $ .LT.alpha*rowmax ) )
THEN
852 CALL ccopy( n-k+1, w( k, k+1 ), 1, w( k, k ),
861 ELSE IF( ( p.EQ.jmax ) .OR. ( rowmax.LE.colmax ) )
882 CALL ccopy( 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 ) = real( a( k, k ) )
913 CALL ccopy( p-k-1, a( k+1, k ), 1, a( p, k+1 ), lda )
914 CALL clacgv( p-k-1, a( p, k+1 ), lda )
916 $
CALL ccopy( n-p, a( p+1, k ), 1, a( p+1, p ), 1 )
924 $
CALL cswap( k-1, a( k, 1 ), lda, a( p, 1 ), lda )
925 CALL cswap( kk, w( k, 1 ), ldw, w( p, 1 ), ldw )
938 a( kp, kp ) = real( a( kk, kk ) )
939 CALL ccopy( kp-kk-1, a( kk+1, kk ), 1, a( kp, kk+1 ),
941 CALL clacgv( kp-kk-1, a( kp, kk+1 ), lda )
943 $
CALL ccopy( n-kp, a( kp+1, kk ), 1, a( kp+1, kp ),
952 $
CALL cswap( k-1, a( kk, 1 ), lda, a( kp, 1 ), lda )
953 CALL cswap( kk, w( kk, 1 ), ldw, w( kp, 1 ), ldw )
956 IF( kstep.EQ.1 )
THEN
974 CALL ccopy( n-k+1, w( k, k ), 1, a( k, k ), 1 )
983 t = real( a( k, k ) )
984 IF( abs( t ).GE.sfmin )
THEN
986 CALL csscal( n-k, r1, a( k+1, k ), 1 )
989 a( ii, k ) = a( ii, k ) / t
995 CALL clacgv( n-k, w( k+1, k ), 1 )
1063 d11 = w( k+1, k+1 ) / d21
1064 d22 = w( k, k ) / conjg( d21 )
1065 t = one / ( real( 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 clacgv( n-k, w( k+1, k ), 1 )
1088 CALL clacgv( 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 ) = real( a( jj, jj ) )
1124 CALL cgemv(
'No transpose', j+jb-jj, k-1, -cone,
1125 $ a( jj, 1 ), lda, w( jj, 1 ), ldw, cone,
1127 a( jj, jj ) = real( a( jj, jj ) )
1133 $
CALL cgemm(
'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 cswap( j, a( jp2, 1 ), lda, a( jj, 1 ), lda )
1165 IF( kstep.EQ.2 .AND. jp1.NE.jj .AND. j.GE.1 )
1166 $
CALL cswap( j, a( jp1, 1 ), lda, a( jj, 1 ), lda )