129 SUBROUTINE csteqr( COMPZ, N, D, E, Z, LDZ, WORK, INFO )
140 REAL D( * ), E( * ), WORK( * )
147 REAL ZERO, ONE, TWO, THREE
148 parameter( zero = 0.0e0, one = 1.0e0, two = 2.0e0,
151 parameter( czero = ( 0.0e0, 0.0e0 ),
152 $ cone = ( 1.0e0, 0.0e0 ) )
154 parameter( maxit = 30 )
157 INTEGER I, ICOMPZ, II, ISCALE, J, JTOT, K, L, L1, LEND,
158 $ LENDM1, LENDP1, LENDSV, LM1, LSV, M, MM, MM1,
160 REAL ANORM, B, C, EPS, EPS2, F, G, P, R, RT1, RT2,
161 $ S, SAFMAX, SAFMIN, SSFMAX, SSFMIN, TST
165 REAL SLAMCH, SLANST, SLAPY2
166 EXTERNAL lsame, slamch, slanst, slapy2
174 INTRINSIC abs, max, sign, sqrt
182 IF( lsame( compz,
'N' ) )
THEN
184 ELSE IF( lsame( compz,
'V' ) )
THEN
186 ELSE IF( lsame( compz,
'I' ) )
THEN
191 IF( icompz.LT.0 )
THEN
193 ELSE IF( n.LT.0 )
THEN
195 ELSE IF( ( ldz.LT.1 ) .OR. ( icompz.GT.0 .AND. ldz.LT.max( 1,
200 CALL xerbla(
'CSTEQR', -info )
219 safmin = slamch(
'S' )
220 safmax = one / safmin
221 ssfmax = sqrt( safmax ) / three
222 ssfmin = sqrt( safmin ) / eps2
228 $
CALL claset(
'Full', n, n, czero, cone, z, ldz )
250 IF( tst.LE.( sqrt( abs( d( m ) ) )*sqrt( abs( d( m+
251 $ 1 ) ) ) )*eps )
THEN
270 anorm = slanst(
'I', lend-l+1, d( l ), e( l ) )
274 IF( anorm.GT.ssfmax )
THEN
276 CALL slascl(
'G', 0, 0, anorm, ssfmax, lend-l+1, 1, d( l ),
279 CALL slascl(
'G', 0, 0, anorm, ssfmax, lend-l, 1, e( l ), n,
281 ELSE IF( anorm.LT.ssfmin )
THEN
283 CALL slascl(
'G', 0, 0, anorm, ssfmin, lend-l+1, 1, d( l ),
286 CALL slascl(
'G', 0, 0, anorm, ssfmin, lend-l, 1, e( l ), n,
292 IF( abs( d( lend ) ).LT.abs( d( l ) ) )
THEN
307 tst = abs( e( m ) )**2
308 IF( tst.LE.( eps2*abs( d( m ) ) )*abs( d( m+1 ) )+
326 IF( icompz.GT.0 )
THEN
327 CALL slaev2( d( l ), e( l ), d( l+1 ), rt1, rt2, c,
331 CALL clasr(
'R',
'V',
'B', n, 2, work( l ),
332 $ work( n-1+l ), z( 1, l ), ldz )
334 CALL slae2( d( l ), e( l ), d( l+1 ), rt1, rt2 )
351 g = ( d( l+1 )-p ) / ( two*e( l ) )
353 g = d( m ) - p + ( e( l ) / ( g+sign( r, g ) ) )
365 CALL slartg( g, f, c, s, r )
369 r = ( d( i )-g )*s + two*c*b
376 IF( icompz.GT.0 )
THEN
385 IF( icompz.GT.0 )
THEN
387 CALL clasr(
'R',
'V',
'B', n, mm, work( l ),
415 DO 100 m = l, lendp1, -1
416 tst = abs( e( m-1 ) )**2
417 IF( tst.LE.( eps2*abs( d( m ) ) )*abs( d( m-1 ) )+
435 IF( icompz.GT.0 )
THEN
436 CALL slaev2( d( l-1 ), e( l-1 ), d( l ), rt1, rt2, c,
440 CALL clasr(
'R',
'V',
'F', n, 2, work( m ),
441 $ work( n-1+m ), z( 1, l-1 ), ldz )
443 CALL slae2( d( l-1 ), e( l-1 ), d( l ), rt1, rt2 )
460 g = ( d( l-1 )-p ) / ( two*e( l-1 ) )
462 g = d( m ) - p + ( e( l-1 ) / ( g+sign( r, g ) ) )
474 CALL slartg( g, f, c, s, r )
478 r = ( d( i+1 )-g )*s + two*c*b
485 IF( icompz.GT.0 )
THEN
494 IF( icompz.GT.0 )
THEN
496 CALL clasr(
'R',
'V',
'F', n, mm, work( m ),
520 IF( iscale.EQ.1 )
THEN
521 CALL slascl(
'G', 0, 0, ssfmax, anorm, lendsv-lsv+1, 1,
522 $ d( lsv ), n, info )
523 CALL slascl(
'G', 0, 0, ssfmax, anorm, lendsv-lsv, 1,
526 ELSE IF( iscale.EQ.2 )
THEN
527 CALL slascl(
'G', 0, 0, ssfmin, anorm, lendsv-lsv+1, 1,
528 $ d( lsv ), n, info )
529 CALL slascl(
'G', 0, 0, ssfmin, anorm, lendsv-lsv, 1,
537 IF( jtot.EQ.nmaxit )
THEN
549 IF( icompz.EQ.0 )
THEN
553 CALL slasrt(
'I', n, d, info )
564 IF( d( j ).LT.p )
THEN
572 CALL cswap( n, z( 1, i ), 1, z( 1, k ), 1 )