1 SUBROUTINE dsteqr2( COMPZ, N, D, E, Z, LDZ, NR, WORK, INFO )
10 INTEGER INFO, LDZ, N, NR
13 DOUBLE PRECISION D( * ), E( * ), WORK( * ), Z( LDZ, * )
83 DOUBLE PRECISION ZERO, ONE, TWO, THREE
84 parameter( zero = 0.0d0, one = 1.0d0, two = 2.0d0,
87 parameter( maxit = 30 )
90 INTEGER I, ICOMPZ, II, ISCALE, J, JTOT, K, L, L1, LEND,
91 $ LENDM1, LENDP1, LENDSV, LM1, LSV, M, MM, MM1,
93 DOUBLE PRECISION ANORM, B, C, EPS, EPS2, F, G, P, R, RT1, RT2,
94 $ S, SAFMAX, SAFMIN, SSFMAX, SSFMIN, TST
98 DOUBLE PRECISION DLAMCH, DLANST, DLAPY2
99 EXTERNAL lsame, dlamch, dlanst, dlapy2
102 EXTERNAL dlae2, dlaev2, dlartg, dlascl, dlasr,
103 $ dlasrt, dswap, xerbla
106 INTRINSIC abs,
max, sign, sqrt
114 IF( lsame( compz,
'N' ) )
THEN
116 ELSE IF( lsame( compz,
'I' ) )
THEN
121 IF( icompz.LT.0 )
THEN
123 ELSE IF( n.LT.0 )
THEN
125 ELSE IF( icompz.GT.0 .AND. ldz.LT.
max( 1, nr ) )
THEN
129 CALL xerbla(
'DSTEQR2', -info )
148 safmin = dlamch(
'S' )
149 safmax = one / safmin
150 ssfmax = sqrt( safmax ) / three
151 ssfmin = sqrt( safmin ) / eps2
176 IF( tst.LE.( sqrt( abs( d( m ) ) )*sqrt( abs( d( m+
177 $ 1 ) ) ) )*eps )
THEN
196 anorm = dlanst(
'I', lend-l+1, d( l ), e( l ) )
200 IF( anorm.GT.ssfmax )
THEN
202 CALL dlascl(
'G', 0, 0, anorm, ssfmax, lend-l+1, 1, d( l ), n,
204 CALL dlascl(
'G', 0, 0, anorm, ssfmax, lend-l, 1, e( l ), n,
206 ELSE IF( anorm.LT.ssfmin )
THEN
208 CALL dlascl(
'G', 0, 0, anorm, ssfmin, lend-l+1, 1, d( l ), n,
210 CALL dlascl(
'G', 0, 0, anorm, ssfmin, lend-l, 1, e( l ), n,
216 IF( abs( d( lend ) ).LT.abs( d( l ) ) )
THEN
231 tst = abs( e( m ) )**2
232 IF( tst.LE.( eps2*abs( d( m ) ) )*abs( d( m+1 ) )+
250 IF( icompz.GT.0 )
THEN
251 CALL dlaev2( d( l ), e( l ), d( l+1 ), rt1, rt2, c, s )
254 CALL dlasr(
'R',
'V',
'B', nr, 2, work( l ),
255 $ work( n-1+l ), z( 1, l ), ldz )
257 CALL dlae2( d( l ), e( l ), d( l+1 ), rt1, rt2 )
274 g = ( d( l+1 )-p ) / ( two*e( l ) )
276 g = d( m ) - p + ( e( l ) / ( g+sign( r, g ) ) )
288 CALL dlartg( g, f, c, s, r )
292 r = ( d( i )-g )*s + two*c*b
299 IF( icompz.GT.0 )
THEN
308 IF( icompz.GT.0 )
THEN
310 CALL dlasr(
'R',
'V',
'B', nr, mm, work( l ), work( n-1+l ),
337 DO 100 m = l, lendp1, -1
338 tst = abs( e( m-1 ) )**2
339 IF( tst.LE.( eps2*abs( d( m ) ) )*abs( d( m-1 ) )+
357 IF( icompz.GT.0 )
THEN
358 CALL dlaev2( d( l-1 ), e( l-1 ), d( l ), rt1, rt2, c, s )
361 CALL dlasr(
'R',
'V',
'F', nr, 2, work( m ),
362 $ work( n-1+m ), z( 1, l-1 ), ldz )
364 CALL dlae2( d( l-1 ), e( l-1 ), d( l ), rt1, rt2 )
381 g = ( d( l-1 )-p ) / ( two*e( l-1 ) )
383 g = d( m ) - p + ( e( l-1 ) / ( g+sign( r, g ) ) )
395 CALL dlartg( g, f, c, s, r )
399 r = ( d( i+1 )-g )*s + two*c*b
406 IF( icompz.GT.0 )
THEN
415 IF( icompz.GT.0 )
THEN
417 CALL dlasr(
'R',
'V',
'F', nr, mm, work( m ), work( n-1+m ),
440 IF( iscale.EQ.1 )
THEN
441 CALL dlascl(
'G', 0, 0, ssfmax, anorm, lendsv-lsv+1, 1,
442 $ d( lsv ), n, info )
443 CALL dlascl(
'G', 0, 0, ssfmax, anorm, lendsv-lsv, 1, e( lsv ),
445 ELSE IF( iscale.EQ.2 )
THEN
446 CALL dlascl(
'G', 0, 0, ssfmin, anorm, lendsv-lsv+1, 1,
447 $ d( lsv ), n, info )
448 CALL dlascl(
'G', 0, 0, ssfmin, anorm, lendsv-lsv, 1, e( lsv ),
466 IF( icompz.EQ.0 )
THEN
470 CALL dlasrt(
'I', n, d, info )
481 IF( d( j ).LT.p )
THEN
489 CALL dswap( nr, z( 1, i ), 1, z( 1, k ), 1 )