191 INTEGER INFO, KB, LDA, LDW, N, NB
195 COMPLEX A( LDA, * ), W( LDW, * )
202 parameter( zero = 0.0e+0, one = 1.0e+0 )
204 parameter( cone = ( 1.0e+0, 0.0e+0 ) )
206 parameter( eight = 8.0e+0, sevten = 17.0e+0 )
210 INTEGER IMAX, ITEMP, II, J, JB, JJ, JMAX, JP1, JP2, K,
211 $ kk, kkw, kp, kstep, kw, p
212 REAL ABSAKK, ALPHA, COLMAX, STEMP, R1, ROWMAX, T,
214 COMPLEX D11, D21, D22, Z
220 EXTERNAL lsame, icamax, slamch
226 INTRINSIC abs, conjg, aimag, max, min, real, sqrt
232 cabs1( z ) = abs( real( z ) ) + abs( aimag( z ) )
240 alpha = ( one+sqrt( sevten ) ) / eight
244 sfmin = slamch(
'S' )
246 IF( lsame( uplo,
'U' ) )
THEN
263 IF( ( k.LE.n-nb+1 .AND. nb.LT.n ) .OR. k.LT.1 )
272 $
CALL ccopy( k-1, a( 1, k ), 1, w( 1, kw ), 1 )
273 w( k, kw ) = real( a( k, k ) )
275 CALL cgemv(
'No transpose', k, n-k, -cone, a( 1, k+1 ), lda,
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, kw-1 ),
337 w( imax, kw-1 ) = real( a( imax, imax ) )
339 CALL ccopy( k-imax, a( imax, imax+1 ), lda,
340 $ w( imax+1, kw-1 ), 1 )
341 CALL clacgv( k-imax, w( imax+1, kw-1 ), 1 )
344 CALL cgemv(
'No transpose', k, n-k, -cone,
345 $ a( 1, k+1 ), lda, w( imax, kw+1 ), ldw,
346 $ cone, w( 1, kw-1 ), 1 )
347 w( imax, kw-1 ) = real( w( imax, kw-1 ) )
355 jmax = imax + icamax( k-imax, w( imax+1, kw-1 ),
357 rowmax = cabs1( w( jmax, kw-1 ) )
363 itemp = icamax( imax-1, w( 1, kw-1 ), 1 )
364 stemp = cabs1( w( itemp, kw-1 ) )
365 IF( stemp.GT.rowmax )
THEN
376 IF( .NOT.( abs( real( w( imax,kw-1 ) ) )
377 $ .LT.alpha*rowmax ) )
THEN
386 CALL ccopy( k, w( 1, kw-1 ), 1, w( 1, kw ), 1 )
394 ELSE IF( ( p.EQ.jmax ) .OR. ( rowmax.LE.colmax ) )
415 CALL ccopy( k, w( 1, kw-1 ), 1, w( 1, kw ), 1 )
422 IF( .NOT.done )
GOTO 12
441 IF( ( kstep.EQ.2 ) .AND. ( p.NE.k ) )
THEN
448 a( p, p ) = real( a( k, k ) )
449 CALL ccopy( k-1-p, a( p+1, k ), 1, a( p, p+1 ),
451 CALL clacgv( k-1-p, a( p, p+1 ), lda )
453 $
CALL ccopy( p-1, a( 1, k ), 1, a( 1, p ), 1 )
461 $
CALL cswap( n-k, a( k, k+1 ), lda, a( p, k+1 ),
463 CALL cswap( n-kk+1, w( k, kkw ), ldw, w( p, kkw ),
477 a( kp, kp ) = real( a( kk, kk ) )
478 CALL ccopy( kk-1-kp, a( kp+1, kk ), 1, a( kp, kp+1 ),
480 CALL clacgv( kk-1-kp, a( kp, kp+1 ), lda )
482 $
CALL ccopy( kp-1, a( 1, kk ), 1, a( 1, kp ), 1 )
490 $
CALL cswap( n-k, a( kk, k+1 ), lda, a( kp, k+1 ),
492 CALL cswap( n-kk+1, w( kk, kkw ), ldw, w( kp, kkw ),
496 IF( kstep.EQ.1 )
THEN
514 CALL ccopy( k, w( 1, kw ), 1, a( 1, k ), 1 )
523 t = real( a( k, k ) )
524 IF( abs( t ).GE.sfmin )
THEN
526 CALL csscal( k-1, r1, a( 1, k ), 1 )
529 a( ii, k ) = a( ii, k ) / t
535 CALL clacgv( k-1, w( 1, kw ), 1 )
603 d11 = w( k, kw ) / conjg( d21 )
604 d22 = w( k-1, kw-1 ) / d21
605 t = one / ( real( d11*d22 )-one )
612 a( j, k-1 ) = t*( ( d11*w( j, kw-1 )-w( j, kw ) ) /
614 a( j, k ) = t*( ( d22*w( j, kw )-w( j, kw-1 ) ) /
621 a( k-1, k-1 ) = w( k-1, kw-1 )
622 a( k-1, k ) = w( k-1, kw )
623 a( k, k ) = w( k, kw )
627 CALL clacgv( k-1, w( 1, kw ), 1 )
628 CALL clacgv( k-2, w( 1, kw-1 ), 1 )
636 IF( kstep.EQ.1 )
THEN
657 DO 50 j = ( ( k-1 ) / nb )*nb + 1, 1, -nb
658 jb = min( nb, k-j+1 )
662 DO 40 jj = j, j + jb - 1
663 a( jj, jj ) = real( a( jj, jj ) )
664 CALL cgemv(
'No transpose', jj-j+1, n-k, -cone,
665 $ a( j, k+1 ), lda, w( jj, kw+1 ), ldw, cone,
667 a( jj, jj ) = real( a( jj, jj ) )
673 $
CALL cgemm(
'No transpose',
'Transpose', j-1, jb, n-k,
674 $ -cone, a( 1, k+1 ), lda, w( j, kw+1 ), ldw,
675 $ cone, a( 1, j ), lda )
702 IF( jp2.NE.jj .AND. j.LE.n )
703 $
CALL cswap( n-j+1, a( jp2, j ), lda, a( jj, j ), lda )
705 IF( kstep.EQ.2 .AND. jp1.NE.jj .AND. j.LE.n )
706 $
CALL cswap( n-j+1, a( jp1, j ), lda, a( jj, j ), lda )
727 IF( ( k.GE.nb .AND. nb.LT.n ) .OR. k.GT.n )
735 w( k, k ) = real( a( k, k ) )
737 $
CALL ccopy( n-k, a( k+1, k ), 1, w( k+1, k ), 1 )
739 CALL cgemv(
'No transpose', n-k+1, k-1, -cone, a( k, 1 ),
740 $ lda, w( k, 1 ), ldw, cone, w( k, k ), 1 )
741 w( k, k ) = real( w( k, k ) )
747 absakk = abs( real( w( k, k ) ) )
754 imax = k + icamax( n-k, w( k+1, k ), 1 )
755 colmax = cabs1( w( imax, k ) )
760 IF( max( absakk, colmax ).EQ.zero )
THEN
767 a( k, k ) = real( w( k, k ) )
769 $
CALL ccopy( n-k, w( k+1, k ), 1, a( k+1, k ), 1 )
780 IF( .NOT.( absakk.LT.alpha*colmax ) )
THEN
799 CALL ccopy( imax-k, a( imax, k ), lda, w( k, k+1 ), 1)
800 CALL clacgv( imax-k, w( k, k+1 ), 1 )
801 w( imax, k+1 ) = real( a( imax, imax ) )
804 $
CALL ccopy( n-imax, a( imax+1, imax ), 1,
805 $ w( imax+1, k+1 ), 1 )
808 CALL cgemv(
'No transpose', n-k+1, k-1, -cone,
809 $ a( k, 1 ), lda, w( imax, 1 ), ldw,
810 $ cone, w( k, k+1 ), 1 )
811 w( imax, k+1 ) = real( w( imax, k+1 ) )
819 jmax = k - 1 + icamax( imax-k, w( k, k+1 ), 1 )
820 rowmax = cabs1( w( jmax, k+1 ) )
826 itemp = imax + icamax( n-imax, w( imax+1, k+1 ), 1)
827 stemp = cabs1( w( itemp, k+1 ) )
828 IF( stemp.GT.rowmax )
THEN
839 IF( .NOT.( abs( real( w( imax,k+1 ) ) )
840 $ .LT.alpha*rowmax ) )
THEN
849 CALL ccopy( n-k+1, w( k, k+1 ), 1, w( k, k ), 1 )
857 ELSE IF( ( p.EQ.jmax ) .OR. ( rowmax.LE.colmax ) )
878 CALL ccopy( n-k+1, w( k, k+1 ), 1, w( k, k ), 1 )
885 IF( .NOT.done )
GOTO 72
900 IF( ( kstep.EQ.2 ) .AND. ( p.NE.k ) )
THEN
907 a( p, p ) = real( a( k, k ) )
908 CALL ccopy( p-k-1, a( k+1, k ), 1, a( p, k+1 ), lda )
909 CALL clacgv( p-k-1, a( p, k+1 ), lda )
911 $
CALL ccopy( n-p, a( p+1, k ), 1, a( p+1, p ), 1 )
919 $
CALL cswap( k-1, a( k, 1 ), lda, a( p, 1 ), lda )
920 CALL cswap( kk, w( k, 1 ), ldw, w( p, 1 ), ldw )
933 a( kp, kp ) = real( a( kk, kk ) )
934 CALL ccopy( kp-kk-1, a( kk+1, kk ), 1, a( kp, kk+1 ),
936 CALL clacgv( kp-kk-1, a( kp, kk+1 ), lda )
938 $
CALL ccopy( n-kp, a( kp+1, kk ), 1, a( kp+1, kp ), 1 )
946 $
CALL cswap( k-1, a( kk, 1 ), lda, a( kp, 1 ), lda )
947 CALL cswap( kk, w( kk, 1 ), ldw, w( kp, 1 ), ldw )
950 IF( kstep.EQ.1 )
THEN
968 CALL ccopy( n-k+1, w( k, k ), 1, a( k, k ), 1 )
977 t = real( a( k, k ) )
978 IF( abs( t ).GE.sfmin )
THEN
980 CALL csscal( n-k, r1, a( k+1, k ), 1 )
983 a( ii, k ) = a( ii, k ) / t
989 CALL clacgv( n-k, w( k+1, k ), 1 )
1057 d11 = w( k+1, k+1 ) / d21
1058 d22 = w( k, k ) / conjg( d21 )
1059 t = one / ( real( d11*d22 )-one )
1066 a( j, k ) = t*( ( d11*w( j, k )-w( j, k+1 ) ) /
1068 a( j, k+1 ) = t*( ( d22*w( j, k+1 )-w( j, k ) ) /
1075 a( k, k ) = w( k, k )
1076 a( k+1, k ) = w( k+1, k )
1077 a( k+1, k+1 ) = w( k+1, k+1 )
1081 CALL clacgv( n-k, w( k+1, k ), 1 )
1082 CALL clacgv( n-k-1, w( k+2, k+1 ), 1 )
1090 IF( kstep.EQ.1 )
THEN
1112 jb = min( nb, n-j+1 )
1116 DO 100 jj = j, j + jb - 1
1117 a( jj, jj ) = real( a( jj, jj ) )
1118 CALL cgemv(
'No transpose', j+jb-jj, k-1, -cone,
1119 $ a( jj, 1 ), lda, w( jj, 1 ), ldw, cone,
1121 a( jj, jj ) = real( a( jj, jj ) )
1127 $
CALL cgemm(
'No transpose',
'Transpose', n-j-jb+1, jb,
1128 $ k-1, -cone, a( j+jb, 1 ), lda, w( j, 1 ),
1129 $ ldw, cone, a( j+jb, j ), lda )
1156 IF( jp2.NE.jj .AND. j.GE.1 )
1157 $
CALL cswap( j, a( jp2, 1 ), lda, a( jj, 1 ), lda )
1159 IF( kstep.EQ.2 .AND. jp1.NE.jj .AND. j.GE.1 )
1160 $
CALL cswap( j, a( jp1, 1 ), lda, a( jj, 1 ), lda )
subroutine ccopy(n, cx, incx, cy, incy)
CCOPY
subroutine cgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
CGEMM
subroutine cgemv(trans, m, n, alpha, a, lda, x, incx, beta, y, incy)
CGEMV
subroutine clacgv(n, x, incx)
CLACGV conjugates a complex vector.
subroutine clahef_rook(uplo, n, nb, kb, a, lda, ipiv, w, ldw, info)
Download CLAHEF_ROOK + dependencies <a href="http://www.netlib.org/cgi-bin/netlibfiles....
subroutine csscal(n, sa, cx, incx)
CSSCAL
subroutine cswap(n, cx, incx, cy, incy)
CSWAP