128 SUBROUTINE dsteqr( COMPZ, N, D, E, Z, LDZ, WORK, INFO )
139 DOUBLE PRECISION D( * ), E( * ), WORK( * ), Z( LDZ, * )
145 DOUBLE PRECISION ZERO, ONE, TWO, THREE
146 parameter( zero = 0.0d0, one = 1.0d0, two = 2.0d0,
149 parameter( maxit = 30 )
152 INTEGER I, ICOMPZ, II, ISCALE, J, JTOT, K, L, L1, LEND,
153 $ LENDM1, LENDP1, LENDSV, LM1, LSV, M, MM, MM1,
155 DOUBLE PRECISION ANORM, B, C, EPS, EPS2, F, G, P, R, RT1, RT2,
156 $ S, SAFMAX, SAFMIN, SSFMAX, SSFMIN, TST
160 DOUBLE PRECISION DLAMCH, DLANST, DLAPY2
161 EXTERNAL lsame, dlamch, dlanst, dlapy2
169 INTRINSIC abs, max, sign, sqrt
177 IF( lsame( compz,
'N' ) )
THEN
179 ELSE IF( lsame( compz,
'V' ) )
THEN
181 ELSE IF( lsame( compz,
'I' ) )
THEN
186 IF( icompz.LT.0 )
THEN
188 ELSE IF( n.LT.0 )
THEN
190 ELSE IF( ( ldz.LT.1 ) .OR. ( icompz.GT.0 .AND. ldz.LT.max( 1,
195 CALL xerbla(
'DSTEQR', -info )
214 safmin = dlamch(
'S' )
215 safmax = one / safmin
216 ssfmax = sqrt( safmax ) / three
217 ssfmin = sqrt( safmin ) / eps2
223 $
CALL dlaset(
'Full', n, n, zero, one, z, ldz )
245 IF( tst.LE.( sqrt( abs( d( m ) ) )*sqrt( abs( d( m+
246 $ 1 ) ) ) )*eps )
THEN
265 anorm = dlanst(
'M', lend-l+1, d( l ), e( l ) )
269 IF( anorm.GT.ssfmax )
THEN
271 CALL dlascl(
'G', 0, 0, anorm, ssfmax, lend-l+1, 1, d( l ),
274 CALL dlascl(
'G', 0, 0, anorm, ssfmax, lend-l, 1, e( l ), n,
276 ELSE IF( anorm.LT.ssfmin )
THEN
278 CALL dlascl(
'G', 0, 0, anorm, ssfmin, lend-l+1, 1, d( l ),
281 CALL dlascl(
'G', 0, 0, anorm, ssfmin, lend-l, 1, e( l ), n,
287 IF( abs( d( lend ) ).LT.abs( d( l ) ) )
THEN
302 tst = abs( e( m ) )**2
303 IF( tst.LE.( eps2*abs( d( m ) ) )*abs( d( m+1 ) )+
321 IF( icompz.GT.0 )
THEN
322 CALL dlaev2( d( l ), e( l ), d( l+1 ), rt1, rt2, c,
326 CALL dlasr(
'R',
'V',
'B', n, 2, work( l ),
327 $ work( n-1+l ), z( 1, l ), ldz )
329 CALL dlae2( d( l ), e( l ), d( l+1 ), rt1, rt2 )
346 g = ( d( l+1 )-p ) / ( two*e( l ) )
348 g = d( m ) - p + ( e( l ) / ( g+sign( r, g ) ) )
360 CALL dlartg( g, f, c, s, r )
364 r = ( d( i )-g )*s + two*c*b
371 IF( icompz.GT.0 )
THEN
380 IF( icompz.GT.0 )
THEN
382 CALL dlasr(
'R',
'V',
'B', n, mm, work( l ),
410 DO 100 m = l, lendp1, -1
411 tst = abs( e( m-1 ) )**2
412 IF( tst.LE.( eps2*abs( d( m ) ) )*abs( d( m-1 ) )+
430 IF( icompz.GT.0 )
THEN
431 CALL dlaev2( d( l-1 ), e( l-1 ), d( l ), rt1, rt2, c,
435 CALL dlasr(
'R',
'V',
'F', n, 2, work( m ),
436 $ work( n-1+m ), z( 1, l-1 ), ldz )
438 CALL dlae2( d( l-1 ), e( l-1 ), d( l ), rt1, rt2 )
455 g = ( d( l-1 )-p ) / ( two*e( l-1 ) )
457 g = d( m ) - p + ( e( l-1 ) / ( g+sign( r, g ) ) )
469 CALL dlartg( g, f, c, s, r )
473 r = ( d( i+1 )-g )*s + two*c*b
480 IF( icompz.GT.0 )
THEN
489 IF( icompz.GT.0 )
THEN
491 CALL dlasr(
'R',
'V',
'F', n, mm, work( m ),
515 IF( iscale.EQ.1 )
THEN
516 CALL dlascl(
'G', 0, 0, ssfmax, anorm, lendsv-lsv+1, 1,
517 $ d( lsv ), n, info )
518 CALL dlascl(
'G', 0, 0, ssfmax, anorm, lendsv-lsv, 1,
521 ELSE IF( iscale.EQ.2 )
THEN
522 CALL dlascl(
'G', 0, 0, ssfmin, anorm, lendsv-lsv+1, 1,
523 $ d( lsv ), n, info )
524 CALL dlascl(
'G', 0, 0, ssfmin, anorm, lendsv-lsv, 1,
543 IF( icompz.EQ.0 )
THEN
547 CALL dlasrt(
'I', n, d, info )
558 IF( d( j ).LT.p )
THEN
566 CALL dswap( n, z( 1, i ), 1, z( 1, k ), 1 )