170 SUBROUTINE dstein( N, D, E, M, W, IBLOCK, ISPLIT, Z, LDZ, WORK,
171 $ IWORK, IFAIL, INFO )
178 INTEGER INFO, LDZ, M, N
181 INTEGER IBLOCK( * ), IFAIL( * ), ISPLIT( * ),
183 DOUBLE PRECISION D( * ), E( * ), W( * ), WORK( * ), Z( LDZ, * )
189 DOUBLE PRECISION ZERO, ONE, TEN, ODM3, ODM1
190 parameter( zero = 0.0d+0, one = 1.0d+0, ten = 1.0d+1,
191 $ odm3 = 1.0d-3, odm1 = 1.0d-1 )
192 INTEGER MAXITS, EXTRA
193 parameter( maxits = 5, extra = 2 )
196 INTEGER B1, BLKSIZ, BN, GPIND, I, IINFO, INDRV1,
197 $ indrv2, indrv3, indrv4, indrv5, its, j, j1,
198 $ jblk, jmax, nblk, nrmchk
199 DOUBLE PRECISION DTPCRT, EPS, EPS1, NRM, ONENRM, ORTOL, PERTOL,
200 $ scl, sep, tol, xj, xjm, ztr
207 DOUBLE PRECISION DDOT, DLAMCH, DNRM2
208 EXTERNAL idamax, ddot, dlamch, dnrm2
216 INTRINSIC abs, max, sqrt
229 ELSE IF( m.LT.0 .OR. m.GT.n )
THEN
231 ELSE IF( ldz.LT.max( 1, n ) )
THEN
235 IF( iblock( j ).LT.iblock( j-1 ) )
THEN
239 IF( iblock( j ).EQ.iblock( j-1 ) .AND. w( j ).LT.w( j-1 ) )
249 CALL xerbla(
'DSTEIN', -info )
255 IF( n.EQ.0 .OR. m.EQ.0 )
THEN
257 ELSE IF( n.EQ.1 )
THEN
264 eps = dlamch(
'Precision' )
283 DO 160 nblk = 1, iblock( m )
290 b1 = isplit( nblk-1 ) + 1
300 onenrm = abs( d( b1 ) ) + abs( e( b1 ) )
301 onenrm = max( onenrm, abs( d( bn ) )+abs( e( bn-1 ) ) )
302 DO 50 i = b1 + 1, bn - 1
303 onenrm = max( onenrm, abs( d( i ) )+abs( e( i-1 ) )+
308 dtpcrt = sqrt( odm1 / blksiz )
315 IF( iblock( j ).NE.nblk )
THEN
324 IF( blksiz.EQ.1 )
THEN
325 work( indrv1+1 ) = one
345 CALL dlarnv( 2, iseed, blksiz, work( indrv1+1 ) )
349 CALL dcopy( blksiz, d( b1 ), 1, work( indrv4+1 ), 1 )
350 CALL dcopy( blksiz-1, e( b1 ), 1, work( indrv2+2 ), 1 )
351 CALL dcopy( blksiz-1, e( b1 ), 1, work( indrv3+1 ), 1 )
356 CALL dlagtf( blksiz, work( indrv4+1 ), xj,
358 $ work( indrv3+1 ), tol, work( indrv5+1 ), iwork,
370 jmax = idamax( blksiz, work( indrv1+1 ), 1 )
371 scl = blksiz*onenrm*max( eps,
372 $ abs( work( indrv4+blksiz ) ) ) /
373 $ abs( work( indrv1+jmax ) )
374 CALL dscal( blksiz, scl, work( indrv1+1 ), 1 )
378 CALL dlagts( -1, blksiz, work( indrv4+1 ),
380 $ work( indrv3+1 ), work( indrv5+1 ), iwork,
381 $ work( indrv1+1 ), tol, iinfo )
388 IF( abs( xj-xjm ).GT.ortol )
390 IF( gpind.NE.j )
THEN
391 DO 80 i = gpind, j - 1
392 ztr = -ddot( blksiz, work( indrv1+1 ), 1, z( b1,
395 CALL daxpy( blksiz, ztr, z( b1, i ), 1,
396 $ work( indrv1+1 ), 1 )
403 jmax = idamax( blksiz, work( indrv1+1 ), 1 )
404 nrm = abs( work( indrv1+jmax ) )
412 IF( nrmchk.LT.extra+1 )
427 scl = one / dnrm2( blksiz, work( indrv1+1 ), 1 )
428 jmax = idamax( blksiz, work( indrv1+1 ), 1 )
429 IF( work( indrv1+jmax ).LT.zero )
431 CALL dscal( blksiz, scl, work( indrv1+1 ), 1 )
437 z( b1+i-1, j ) = work( indrv1+i )