1 SUBROUTINE ssteqr2( COMPZ, N, D, E, Z, LDZ, NR, WORK, INFO )
10 INTEGER INFO, LDZ, N, NR
13 REAL D( * ), E( * ), WORK( * ), Z( LDZ, * )
82 REAL ZERO, ONE, TWO, THREE
83 parameter( zero = 0.0e0, one = 1.0e0, two = 2.0e0,
86 parameter( maxit = 30 )
89 INTEGER I, ICOMPZ, II, ISCALE, J, JTOT, K, L, L1, LEND,
90 $ LENDM1, LENDP1, LENDSV, LM1, LSV, M, MM, MM1,
92 REAL ANORM, B, C, EPS, EPS2, F, G, P, R, RT1, RT2,
93 $ S, SAFMAX, SAFMIN, SSFMAX, SSFMIN, TST
97 REAL SLAMCH, SLANST, SLAPY2
98 EXTERNAL lsame, slamch, slanst, slapy2
101 EXTERNAL slae2, slaev2, slartg, slascl, slasr,
102 $ slasrt, sswap, xerbla
105 INTRINSIC abs,
max, sign, sqrt
113 IF( lsame( compz,
'N' ) )
THEN
115 ELSE IF( lsame( compz,
'I' ) )
THEN
120 IF( icompz.LT.0 )
THEN
122 ELSE IF( n.LT.0 )
THEN
124 ELSE IF( icompz.GT.0 .AND. ldz.LT.
max( 1, nr ) )
THEN
128 CALL xerbla(
'SSTEQR2', -info )
147 safmin = slamch(
'S' )
148 safmax = one / safmin
149 ssfmax = sqrt( safmax ) / three
150 ssfmin = sqrt( safmin ) / eps2
175 IF( tst.LE.( sqrt( abs( d( m ) ) )*sqrt( abs( d( m+
176 $ 1 ) ) ) )*eps )
THEN
195 anorm = slanst(
'I', lend-l+1, d( l ), e( l ) )
199 IF( anorm.GT.ssfmax )
THEN
201 CALL slascl(
'G', 0, 0, anorm, ssfmax, lend-l+1, 1, d( l ), n,
203 CALL slascl(
'G', 0, 0, anorm, ssfmax, lend-l, 1, e( l ), n,
205 ELSE IF( anorm.LT.ssfmin )
THEN
207 CALL slascl(
'G', 0, 0, anorm, ssfmin, lend-l+1, 1, d( l ), n,
209 CALL slascl(
'G', 0, 0, anorm, ssfmin, lend-l, 1, e( l ), n,
215 IF( abs( d( lend ) ).LT.abs( d( l ) ) )
THEN
230 tst = abs( e( m ) )**2
231 IF( tst.LE.( eps2*abs( d( m ) ) )*abs( d( m+1 ) )+
249 IF( icompz.GT.0 )
THEN
250 CALL slaev2( d( l ), e( l ), d( l+1 ), rt1, rt2, c, s )
253 CALL slasr(
'R',
'V',
'B', nr, 2, work( l ),
254 $ work( n-1+l ), z( 1, l ), ldz )
256 CALL slae2( d( l ), e( l ), d( l+1 ), rt1, rt2 )
273 g = ( d( l+1 )-p ) / ( two*e( l ) )
275 g = d( m ) - p + ( e( l ) / ( g+sign( r, g ) ) )
287 CALL slartg( g, f, c, s, r )
291 r = ( d( i )-g )*s + two*c*b
298 IF( icompz.GT.0 )
THEN
307 IF( icompz.GT.0 )
THEN
309 CALL slasr(
'R',
'V',
'B', nr, mm, work( l ), work( n-1+l ),
336 DO 100 m = l, lendp1, -1
337 tst = abs( e( m-1 ) )**2
338 IF( tst.LE.( eps2*abs( d( m ) ) )*abs( d( m-1 ) )+
356 IF( icompz.GT.0 )
THEN
357 CALL slaev2( d( l-1 ), e( l-1 ), d( l ), rt1, rt2, c, s )
360 CALL slasr(
'R',
'V',
'F', nr, 2, work( m ),
361 $ work( n-1+m ), z( 1, l-1 ), ldz )
363 CALL slae2( d( l-1 ), e( l-1 ), d( l ), rt1, rt2 )
380 g = ( d( l-1 )-p ) / ( two*e( l-1 ) )
382 g = d( m ) - p + ( e( l-1 ) / ( g+sign( r, g ) ) )
394 CALL slartg( g, f, c, s, r )
398 r = ( d( i+1 )-g )*s + two*c*b
405 IF( icompz.GT.0 )
THEN
414 IF( icompz.GT.0 )
THEN
416 CALL slasr(
'R',
'V',
'F', nr, mm, work( m ), work( n-1+m ),
439 IF( iscale.EQ.1 )
THEN
440 CALL slascl(
'G', 0, 0, ssfmax, anorm, lendsv-lsv+1, 1,
441 $ d( lsv ), n, info )
442 CALL slascl(
'G', 0, 0, ssfmax, anorm, lendsv-lsv, 1, e( lsv ),
444 ELSE IF( iscale.EQ.2 )
THEN
445 CALL slascl(
'G', 0, 0, ssfmin, anorm, lendsv-lsv+1, 1,
446 $ d( lsv ), n, info )
447 CALL slascl(
'G', 0, 0, ssfmin, anorm, lendsv-lsv, 1, e( lsv ),
465 IF( icompz.EQ.0 )
THEN
469 CALL slasrt(
'I', n, d, info )
480 IF( d( j ).LT.p )
THEN
488 CALL sswap( nr, z( 1, i ), 1, z( 1, k ), 1 )