170 SUBROUTINE slaein( 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 REAL BIGNUM, EPS3, SMLNUM, WI, WR
183 REAL B( LDB, * ), H( LDH, * ), VI( * ), VR( * ),
190 REAL ZERO, ONE, TENTH
191 parameter( zero = 0.0e+0, one = 1.0e+0, tenth = 1.0e-1 )
194 CHARACTER NORMIN, TRANS
195 INTEGER I, I1, I2, I3, IERR, ITS, J
196 REAL ABSBII, ABSBJJ, EI, EJ, GROWTO, NORM, NRMSML,
197 $ rec, rootn, scale, temp, vcrit, vmax, vnorm, w,
202 REAL SASUM, SLAPY2, SNRM2
203 EXTERNAL isamax, sasum, slapy2, snrm2
209 INTRINSIC abs, max, real, sqrt
218 rootn = sqrt( real( 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 = snrm2( n, vr, 1 )
248 CALL sscal( 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 slatrs(
'Upper', trans,
'Nonunit', normin, n, b, ldb,
336 $ vr, scale, work, ierr )
341 vnorm = sasum( 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 = isamax( n, vr, 1 )
364 CALL sscal( n, one / abs( vr( i ) ), vr, 1 )
381 norm = slapy2( snrm2( n, vr, 1 ), snrm2( n, vi, 1 ) )
382 rec = ( eps3*rootn ) / max( norm, nrmsml )
383 CALL sscal( n, rec, vr, 1 )
384 CALL sscal( n, rec, vi, 1 )
401 absbii = slapy2( 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 ) = sasum( n-i, b( i, i+1 ), ldb ) +
444 $ sasum( n-i, b( i+2, i ), 1 )
446 IF( b( n, n ).EQ.zero .AND. b( n+1, n ).EQ.zero )
468 absbjj = slapy2( 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 ) = sasum( j-1, b( 1, j ), 1 ) +
510 $ sasum( 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 sscal( n, rec, vr, 1 )
535 CALL sscal( 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 sscal( n, rec, vr, 1 )
562 CALL sscal( n, rec, vi, 1 )
572 CALL sladiv( 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 = sasum( n, vr, 1 ) + sasum( 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 sscal( n, one / vnorm, vr, 1 )
621 CALL sscal( n, one / vnorm, vi, 1 )
subroutine sladiv(a, b, c, d, p, q)
SLADIV performs complex division in real arithmetic, avoiding unnecessary overflow.
subroutine slaein(rightv, noinit, n, h, ldh, wr, wi, vr, vi, b, ldb, work, eps3, smlnum, bignum, info)
SLAEIN computes a specified right or left eigenvector of an upper Hessenberg matrix by inverse iterat...
subroutine slatrs(uplo, trans, diag, normin, n, a, lda, x, scale, cnorm, info)
SLATRS solves a triangular system of equations with the scale factor set to prevent overflow.
subroutine sscal(n, sa, sx, incx)
SSCAL