3 SUBROUTINE dstein2( N, D, E, M, W, IBLOCK, ISPLIT, ORFAC, Z, LDZ,
4 $ WORK, IWORK, IFAIL, INFO )
12 INTEGER INFO, LDZ, M, N
13 DOUBLE PRECISION ORFAC
16 INTEGER IBLOCK( * ), IFAIL( * ), ISPLIT( * ),
18 DOUBLE PRECISION D( * ), E( * ), W( * ), WORK( * ), Z( LDZ, * )
113 DOUBLE PRECISION ZERO, ONE, TEN, ODM1
114 parameter( zero = 0.0d+0, one = 1.0d+0, ten = 1.0d+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 DOUBLE PRECISION EPS, EPS1, NRM, ONENRM, ORTOL, PERTOL, SCL,
124 $ sep, stpcrt, tol, xj, xjm, ztr
131 DOUBLE PRECISION DASUM, DDOT, DLAMCH, DNRM2
132 EXTERNAL idamax, dasum, ddot, dlamch, dnrm2
135 EXTERNAL daxpy, dcopy, dlagtf, dlagts, dlarnv, dscal,
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(
'DSTEIN2', -info )
180 IF( n.EQ.0 .OR. m.EQ.0 )
THEN
182 ELSE IF( n.EQ.1 )
THEN
189 eps = dlamch(
'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 dlarnv( 2, iseed, blksiz, work( indrv1+1 ) )
274 CALL dcopy( blksiz, d( b1 ), 1, work( indrv4+1 ), 1 )
275 CALL dcopy( blksiz-1, e( b1 ), 1, work( indrv2+2 ), 1 )
276 CALL dcopy( blksiz-1, e( b1 ), 1, work( indrv3+1 ), 1 )
281 CALL dlagtf( 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 $ dasum( blksiz, work( indrv1+1 ), 1 )
297 CALL dscal( blksiz, scl, work( indrv1+1 ), 1 )
301 CALL dlagts( -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 = -ddot( blksiz, work( indrv1+1 ), 1, z( b1, i ),
317 CALL daxpy( blksiz, ztr, z( b1, i ), 1,
318 $ work( indrv1+1 ), 1 )
325 jmax = idamax( blksiz, work( indrv1+1 ), 1 )
326 nrm = abs( work( indrv1+jmax ) )
334 IF( nrmchk.LT.extra+1 )
349 scl = one / dnrm2( blksiz, work( indrv1+1 ), 1 )
350 jmax = idamax( blksiz, work( indrv1+1 ), 1 )
351 IF( work( indrv1+jmax ).LT.zero )
353 CALL dscal( blksiz, scl, work( indrv1+1 ), 1 )
359 z( b1+i-1, j ) = work( indrv1+i )