178 SUBROUTINE zstein( N, D, E, M, W, IBLOCK, ISPLIT, Z, LDZ, WORK,
179 $ IWORK, IFAIL, INFO )
186 INTEGER INFO, LDZ, M, N
189 INTEGER IBLOCK( * ), IFAIL( * ), ISPLIT( * ),
191 DOUBLE PRECISION D( * ), E( * ), W( * ), WORK( * )
192 COMPLEX*16 Z( LDZ, * )
198 COMPLEX*16 CZERO, CONE
199 parameter( czero = ( 0.0d+0, 0.0d+0 ),
200 $ cone = ( 1.0d+0, 0.0d+0 ) )
201 DOUBLE PRECISION ZERO, ONE, TEN, ODM3, ODM1
202 parameter( zero = 0.0d+0, one = 1.0d+0, ten = 1.0d+1,
203 $ odm3 = 1.0d-3, odm1 = 1.0d-1 )
204 INTEGER MAXITS, EXTRA
205 parameter( maxits = 5, extra = 2 )
208 INTEGER B1, BLKSIZ, BN, GPIND, I, IINFO, INDRV1,
209 $ indrv2, indrv3, indrv4, indrv5, its, j, j1,
210 $ jblk, jmax, jr, nblk, nrmchk
211 DOUBLE PRECISION DTPCRT, EPS, EPS1, NRM, ONENRM, ORTOL, PERTOL,
212 $ scl, sep, tol, xj, xjm, ztr
219 DOUBLE PRECISION DLAMCH, DNRM2
220 EXTERNAL idamax, dlamch, dnrm2
227 INTRINSIC abs, dble, dcmplx, max, sqrt
240 ELSE IF( m.LT.0 .OR. m.GT.n )
THEN
242 ELSE IF( ldz.LT.max( 1, n ) )
THEN
246 IF( iblock( j ).LT.iblock( j-1 ) )
THEN
250 IF( iblock( j ).EQ.iblock( j-1 ) .AND. w( j ).LT.w( j-1 ) )
260 CALL xerbla(
'ZSTEIN', -info )
266 IF( n.EQ.0 .OR. m.EQ.0 )
THEN
268 ELSE IF( n.EQ.1 )
THEN
275 eps = dlamch(
'Precision' )
294 DO 180 nblk = 1, iblock( m )
301 b1 = isplit( nblk-1 ) + 1
311 onenrm = abs( d( b1 ) ) + abs( e( b1 ) )
312 onenrm = max( onenrm, abs( d( bn ) )+abs( e( bn-1 ) ) )
313 DO 50 i = b1 + 1, bn - 1
314 onenrm = max( onenrm, abs( d( i ) )+abs( e( i-1 ) )+
319 dtpcrt = sqrt( odm1 / blksiz )
326 IF( iblock( j ).NE.nblk )
THEN
335 IF( blksiz.EQ.1 )
THEN
336 work( indrv1+1 ) = one
356 CALL dlarnv( 2, iseed, blksiz, work( indrv1+1 ) )
360 CALL dcopy( blksiz, d( b1 ), 1, work( indrv4+1 ), 1 )
361 CALL dcopy( blksiz-1, e( b1 ), 1, work( indrv2+2 ), 1 )
362 CALL dcopy( blksiz-1, e( b1 ), 1, work( indrv3+1 ), 1 )
367 CALL dlagtf( blksiz, work( indrv4+1 ), xj,
369 $ work( indrv3+1 ), tol, work( indrv5+1 ), iwork,
381 jmax = idamax( blksiz, work( indrv1+1 ), 1 )
382 scl = blksiz*onenrm*max( eps,
383 $ abs( work( indrv4+blksiz ) ) ) /
384 $ abs( work( indrv1+jmax ) )
385 CALL dscal( blksiz, scl, work( indrv1+1 ), 1 )
389 CALL dlagts( -1, blksiz, work( indrv4+1 ),
391 $ work( indrv3+1 ), work( indrv5+1 ), iwork,
392 $ work( indrv1+1 ), tol, iinfo )
399 IF( abs( xj-xjm ).GT.ortol )
401 IF( gpind.NE.j )
THEN
402 DO 100 i = gpind, j - 1
405 ztr = ztr + work( indrv1+jr )*
406 $ dble( z( b1-1+jr, i ) )
409 work( indrv1+jr ) = work( indrv1+jr ) -
410 $ ztr*dble( z( b1-1+jr, i ) )
418 jmax = idamax( blksiz, work( indrv1+1 ), 1 )
419 nrm = abs( work( indrv1+jmax ) )
427 IF( nrmchk.LT.extra+1 )
442 scl = one / dnrm2( blksiz, work( indrv1+1 ), 1 )
443 jmax = idamax( blksiz, work( indrv1+1 ), 1 )
444 IF( work( indrv1+jmax ).LT.zero )
446 CALL dscal( blksiz, scl, work( indrv1+1 ), 1 )
452 z( b1+i-1, j ) = dcmplx( work( indrv1+i ), zero )