3 SUBROUTINE sstein2( N, D, E, M, W, IBLOCK, ISPLIT, ORFAC, Z, LDZ,
4 $ WORK, IWORK, IFAIL, INFO )
12 INTEGER INFO, LDZ, M, N
16 INTEGER IBLOCK( * ), IFAIL( * ), ISPLIT( * ),
18 REAL D( * ), E( * ), W( * ), WORK( * ), Z( LDZ, * )
113 REAL ZERO, ONE, TEN, ODM1
114 parameter( zero = 0.0e+0, one = 1.0e+0, ten = 1.0e+1,
116 INTEGER MAXITS, EXTRA
117 parameter( maxits = 5, extra = 2 )
120 INTEGER B1, BLKSIZ, BN, GPIND, I, IINFO, INDRV1,
121 $ indrv2, indrv3, indrv4, indrv5, its, j, j1,
122 $ jblk, jmax, nblk, nrmchk
123 REAL EPS, EPS1, NRM, ONENRM, ORTOL, PERTOL, SCL,
124 $ sep, stpcrt, tol, xj, xjm, ztr
131 REAL SASUM, SDOT, SLAMCH, SNRM2
132 EXTERNAL isamax, sasum, sdot, slamch, snrm2
135 EXTERNAL saxpy, scopy, slagtf, slagts, slarnv, sscal,
139 INTRINSIC abs,
max, sqrt
152 ELSE IF( m.LT.0 .OR. m.GT.n )
THEN
154 ELSE IF( orfac.LT.zero )
THEN
156 ELSE IF( ldz.LT.
max( 1, n ) )
THEN
160 IF( iblock( j ).LT.iblock( j-1 ) )
THEN
164 IF( iblock( j ).EQ.iblock( j-1 ) .AND. w( j ).LT.w( j-1 ) )
174 CALL xerbla(
'SSTEIN2', -info )
180 IF( n.EQ.0 .OR. m.EQ.0 )
THEN
182 ELSE IF( n.EQ.1 )
THEN
189 eps = slamch(
'Precision' )
208 DO 160 nblk = 1, iblock( m )
215 b1 = isplit( nblk-1 ) + 1
225 onenrm = abs( d( b1 ) ) + abs( e( b1 ) )
226 onenrm =
max( onenrm, abs( d( bn ) )+abs( e( bn-1 ) ) )
227 DO 50 i = b1 + 1, bn - 1
228 onenrm =
max( onenrm, abs( d( i ) )+abs( e( i-1 ) )+
233 stpcrt = sqrt( odm1 / blksiz )
240 IF( iblock( j ).NE.nblk )
THEN
249 IF( blksiz.EQ.1 )
THEN
250 work( indrv1+1 ) = one
270 CALL slarnv( 2, iseed, blksiz, work( indrv1+1 ) )
274 CALL scopy( blksiz, d( b1 ), 1, work( indrv4+1 ), 1 )
275 CALL scopy( blksiz-1, e( b1 ), 1, work( indrv2+2 ), 1 )
276 CALL scopy( blksiz-1, e( b1 ), 1, work( indrv3+1 ), 1 )
281 CALL slagtf( blksiz, work( indrv4+1 ), xj, work( indrv2+2 ),
282 $ work( indrv3+1 ), tol, work( indrv5+1 ), iwork,
294 scl = blksiz*onenrm*
max( eps,
295 $ abs( work( indrv4+blksiz ) ) ) /
296 $ sasum( blksiz, work( indrv1+1 ), 1 )
297 CALL sscal( blksiz, scl, work( indrv1+1 ), 1 )
301 CALL slagts( -1, blksiz, work( indrv4+1 ), work( indrv2+2 ),
302 $ work( indrv3+1 ), work( indrv5+1 ), iwork,
303 $ work( indrv1+1 ), tol, iinfo )
310 IF( abs( xj-xjm ).GT.ortol )
313 IF( gpind.NE.j )
THEN
314 DO 80 i = gpind, j - 1
315 ztr = -sdot( blksiz, work( indrv1+1 ), 1, z( b1, i ),
317 CALL saxpy( blksiz, ztr, z( b1, i ), 1,
318 $ work( indrv1+1 ), 1 )
325 jmax = isamax( blksiz, work( indrv1+1 ), 1 )
326 nrm = abs( work( indrv1+jmax ) )
334 IF( nrmchk.LT.extra+1 )
349 scl = one / snrm2( blksiz, work( indrv1+1 ), 1 )
350 jmax = isamax( blksiz, work( indrv1+1 ), 1 )
351 IF( work( indrv1+jmax ).LT.zero )
353 CALL sscal( blksiz, scl, work( indrv1+1 ), 1 )
359 z( b1+i-1, j ) = work( indrv1+i )