170 SUBROUTINE dlaein( RIGHTV, NOINIT, N, H, LDH, WR, WI, VR, VI, B,
171 $ LDB, WORK, EPS3, SMLNUM, BIGNUM, INFO )
178 LOGICAL NOINIT, RIGHTV
179 INTEGER INFO, LDB, LDH, N
180 DOUBLE PRECISION BIGNUM, EPS3, SMLNUM, WI, WR
183 DOUBLE PRECISION B( LDB, * ), H( LDH, * ), VI( * ), VR( * ),
190 DOUBLE PRECISION ZERO, ONE, TENTH
191 parameter( zero = 0.0d+0, one = 1.0d+0, tenth = 1.0d-1 )
194 CHARACTER NORMIN, TRANS
195 INTEGER I, I1, I2, I3, IERR, ITS, J
196 DOUBLE PRECISION ABSBII, ABSBJJ, EI, EJ, GROWTO, NORM, NRMSML,
197 $ rec, rootn, scale, temp, vcrit, vmax, vnorm, w,
202 DOUBLE PRECISION DASUM, DLAPY2, DNRM2
203 EXTERNAL idamax, dasum, dlapy2, dnrm2
209 INTRINSIC abs, dble, max, sqrt
218 rootn = sqrt( dble( n ) )
219 growto = tenth / rootn
220 nrmsml = max( one, eps3*rootn )*smlnum
227 b( i, j ) = h( i, j )
229 b( j, j ) = h( j, j ) - wr
232 IF( wi.EQ.zero )
THEN
247 vnorm = dnrm2( n, vr, 1 )
248 CALL dscal( n, ( eps3*rootn ) / max( vnorm, nrmsml ), vr,
259 IF( abs( b( i, i ) ).LT.abs( ei ) )
THEN
267 b( i+1, j ) = b( i, j ) - x*temp
274 IF( b( i, i ).EQ.zero )
279 b( i+1, j ) = b( i+1, j ) - x*b( i, j )
284 IF( b( n, n ).EQ.zero )
296 IF( abs( b( j, j ) ).LT.abs( ej ) )
THEN
304 b( i, j-1 ) = b( i, j ) - x*temp
311 IF( b( j, j ).EQ.zero )
316 b( i, j-1 ) = b( i, j-1 ) - x*b( i, j )
321 IF( b( 1, 1 ).EQ.zero )
335 CALL dlatrs(
'Upper', trans,
'Nonunit', normin, n, b, ldb,
336 $ vr, scale, work, ierr )
341 vnorm = dasum( n, vr, 1 )
342 IF( vnorm.GE.growto*scale )
347 temp = eps3 / ( rootn+one )
352 vr( n-its+1 ) = vr( n-its+1 ) - eps3*rootn
363 i = idamax( n, vr, 1 )
364 CALL dscal( n, one / abs( vr( i ) ), vr, 1 )
381 norm = dlapy2( dnrm2( n, vr, 1 ), dnrm2( n, vi, 1 ) )
382 rec = ( eps3*rootn ) / max( norm, nrmsml )
383 CALL dscal( n, rec, vr, 1 )
384 CALL dscal( n, rec, vi, 1 )
401 absbii = dlapy2( b( i, i ), b( i+1, i ) )
403 IF( absbii.LT.abs( ei ) )
THEN
408 xi = b( i+1, i ) / ei
413 b( i+1, j ) = b( i, j ) - xr*temp
414 b( j+1, i+1 ) = b( j+1, i ) - xi*temp
419 b( i+1, i+1 ) = b( i+1, i+1 ) - xi*wi
420 b( i+2, i+1 ) = b( i+2, i+1 ) + xr*wi
425 IF( absbii.EQ.zero )
THEN
430 ei = ( ei / absbii ) / absbii
434 b( i+1, j ) = b( i+1, j ) - xr*b( i, j ) +
436 b( j+1, i+1 ) = -xr*b( j+1, i ) - xi*b( i, j )
438 b( i+2, i+1 ) = b( i+2, i+1 ) - wi
443 work( i ) = dasum( n-i, b( i, i+1 ), ldb ) +
444 $ dasum( n-i, b( i+2, i ), 1 )
446 IF( b( n, n ).EQ.zero .AND. b( n+1, n ).EQ.zero )
468 absbjj = dlapy2( b( j, j ), b( j+1, j ) )
469 IF( absbjj.LT.abs( ej ) )
THEN
474 xi = b( j+1, j ) / ej
479 b( i, j-1 ) = b( i, j ) - xr*temp
480 b( j, i ) = b( j+1, i ) - xi*temp
485 b( j-1, j-1 ) = b( j-1, j-1 ) + xi*wi
486 b( j, j-1 ) = b( j, j-1 ) - xr*wi
491 IF( absbjj.EQ.zero )
THEN
496 ej = ( ej / absbjj ) / absbjj
500 b( i, j-1 ) = b( i, j-1 ) - xr*b( i, j ) +
502 b( j, i ) = -xr*b( j+1, i ) - xi*b( i, j )
504 b( j, j-1 ) = b( j, j-1 ) + wi
509 work( j ) = dasum( j-1, b( 1, j ), 1 ) +
510 $ dasum( j-1, b( j+1, 1 ), ldb )
512 IF( b( 1, 1 ).EQ.zero .AND. b( 2, 1 ).EQ.zero )
530 DO 250 i = i1, i2, i3
532 IF( work( i ).GT.vcrit )
THEN
534 CALL dscal( n, rec, vr, 1 )
535 CALL dscal( n, rec, vi, 1 )
545 xr = xr - b( i, j )*vr( j ) + b( j+1, i )*vi( j )
546 xi = xi - b( i, j )*vi( j ) - b( j+1, i )*vr( j )
550 xr = xr - b( j, i )*vr( j ) + b( i+1, j )*vi( j )
551 xi = xi - b( j, i )*vi( j ) - b( i+1, j )*vr( j )
555 w = abs( b( i, i ) ) + abs( b( i+1, i ) )
556 IF( w.GT.smlnum )
THEN
558 w1 = abs( xr ) + abs( xi )
559 IF( w1.GT.w*bignum )
THEN
561 CALL dscal( n, rec, vr, 1 )
562 CALL dscal( n, rec, vi, 1 )
572 CALL dladiv( xr, xi, b( i, i ), b( i+1, i ), vr( i ),
574 vmax = max( abs( vr( i ) )+abs( vi( i ) ), vmax )
575 vcrit = bignum / vmax
591 vnorm = dasum( n, vr, 1 ) + dasum( n, vi, 1 )
592 IF( vnorm.GE.growto*scale )
597 y = eps3 / ( rootn+one )
605 vr( n-its+1 ) = vr( n-its+1 ) - eps3*rootn
618 vnorm = max( vnorm, abs( vr( i ) )+abs( vi( i ) ) )
620 CALL dscal( n, one / vnorm, vr, 1 )
621 CALL dscal( n, one / vnorm, vi, 1 )
subroutine dladiv(a, b, c, d, p, q)
DLADIV performs complex division in real arithmetic, avoiding unnecessary overflow.
subroutine dlaein(rightv, noinit, n, h, ldh, wr, wi, vr, vi, b, ldb, work, eps3, smlnum, bignum, info)
DLAEIN computes a specified right or left eigenvector of an upper Hessenberg matrix by inverse iterat...
subroutine dlatrs(uplo, trans, diag, normin, n, a, lda, x, scale, cnorm, info)
DLATRS solves a triangular system of equations with the scale factor set to prevent overflow.
subroutine dscal(n, da, dx, incx)
DSCAL