262 SUBROUTINE dtrsna( JOB, HOWMNY, SELECT, N, T, LDT, VL, LDVL, VR,
263 $ LDVR, S, SEP, MM, M, WORK, LDWORK, IWORK,
271 CHARACTER HOWMNY, JOB
272 INTEGER INFO, LDT, LDVL, LDVR, LDWORK, M, MM, N
277 DOUBLE PRECISION S( * ), SEP( * ), T( LDT, * ), VL( LDVL, * ),
278 $ vr( ldvr, * ), work( ldwork, * )
284 DOUBLE PRECISION ZERO, ONE, TWO
285 PARAMETER ( ZERO = 0.0d+0, one = 1.0d+0, two = 2.0d+0 )
288 LOGICAL PAIR, SOMCON, WANTBH, WANTS, WANTSP
289 INTEGER I, IERR, IFST, ILST, J, K, KASE, KS, N2, NN
290 DOUBLE PRECISION BIGNUM, COND, CS, DELTA, DUMM, EPS, EST, LNRM,
291 $ mu, prod, prod1, prod2, rnrm, scale, smlnum, sn
295 DOUBLE PRECISION DUMMY( 1 )
299 DOUBLE PRECISION DDOT, DLAMCH, DLAPY2, DNRM2
300 EXTERNAL lsame, ddot, dlamch, dlapy2, dnrm2
306 INTRINSIC abs, max, sqrt
312 wantbh = lsame( job,
'B' )
313 wants = lsame( job,
'E' ) .OR. wantbh
314 wantsp = lsame( job,
'V' ) .OR. wantbh
316 somcon = lsame( howmny,
'S' )
319 IF( .NOT.wants .AND. .NOT.wantsp )
THEN
321 ELSE IF( .NOT.lsame( howmny,
'A' ) .AND. .NOT.somcon )
THEN
323 ELSE IF( n.LT.0 )
THEN
325 ELSE IF( ldt.LT.max( 1, n ) )
THEN
327 ELSE IF( ldvl.LT.1 .OR. ( wants .AND. ldvl.LT.n ) )
THEN
329 ELSE IF( ldvr.LT.1 .OR. ( wants .AND. ldvr.LT.n ) )
THEN
344 IF( t( k+1, k ).EQ.zero )
THEN
349 IF(
SELECT( k ) .OR.
SELECT( k+1 ) )
364 ELSE IF( ldwork.LT.1 .OR. ( wantsp .AND. ldwork.LT.n ) )
THEN
369 CALL xerbla(
'DTRSNA', -info )
380 IF( .NOT.
SELECT( 1 ) )
386 $ sep( 1 ) = abs( t( 1, 1 ) )
393 smlnum = dlamch(
'S' ) / eps
394 bignum = one / smlnum
407 $ pair = t( k+1, k ).NE.zero
415 IF( .NOT.
SELECT( k ) .AND. .NOT.
SELECT( k+1 ) )
418 IF( .NOT.
SELECT( k ) )
434 prod = ddot( n, vr( 1, ks ), 1, vl( 1, ks ), 1 )
435 rnrm = dnrm2( n, vr( 1, ks ), 1 )
436 lnrm = dnrm2( n, vl( 1, ks ), 1 )
437 s( ks ) = abs( prod ) / ( rnrm*lnrm )
442 prod1 = ddot( n, vr( 1, ks ), 1, vl( 1, ks ), 1 )
443 prod1 = prod1 + ddot( n, vr( 1, ks+1 ), 1, vl( 1, ks+1 ),
445 prod2 = ddot( n, vl( 1, ks ), 1, vr( 1, ks+1 ), 1 )
446 prod2 = prod2 - ddot( n, vl( 1, ks+1 ), 1, vr( 1, ks ),
448 rnrm = dlapy2( dnrm2( n, vr( 1, ks ), 1 ),
449 $ dnrm2( n, vr( 1, ks+1 ), 1 ) )
450 lnrm = dlapy2( dnrm2( n, vl( 1, ks ), 1 ),
451 $ dnrm2( n, vl( 1, ks+1 ), 1 ) )
452 cond = dlapy2( prod1, prod2 ) / ( rnrm*lnrm )
466 CALL dlacpy(
'Full', n, n, t, ldt, work, ldwork )
469 CALL dtrexc(
'No Q', n, work, ldwork, dummy, 1, ifst, ilst,
470 $ work( 1, n+1 ), ierr )
472 IF( ierr.EQ.1 .OR. ierr.EQ.2 )
THEN
482 IF( work( 2, 1 ).EQ.zero )
THEN
487 work( i, i ) = work( i, i ) - work( 1, 1 )
501 mu = sqrt( abs( work( 1, 2 ) ) )*
502 $ sqrt( abs( work( 2, 1 ) ) )
503 delta = dlapy2( mu, work( 2, 1 ) )
505 sn = -work( 2, 1 ) / delta
519 work( 2, j ) = cs*work( 2, j )
520 work( j, j ) = work( j, j ) - work( 1, 1 )
524 work( 1, n+1 ) = two*mu
526 work( i, n+1 ) = sn*work( 1, i+1 )
537 CALL dlacn2( nn, work( 1, n+2 ), work( 1, n+4 ), iwork,
545 CALL dlaqtr( .true., .true., n-1, work( 2, 2 ),
546 $ ldwork, dummy, dumm, scale,
547 $ work( 1, n+4 ), work( 1, n+6 ),
554 CALL dlaqtr( .true., .false., n-1, work( 2, 2 ),
555 $ ldwork, work( 1, n+1 ), mu, scale,
556 $ work( 1, n+4 ), work( 1, n+6 ),
564 CALL dlaqtr( .false., .true., n-1, work( 2, 2 ),
565 $ ldwork, dummy, dumm, scale,
566 $ work( 1, n+4 ), work( 1, n+6 ),
573 CALL dlaqtr( .false., .false., n-1,
574 $ work( 2, 2 ), ldwork,
575 $ work( 1, n+1 ), mu, scale,
576 $ work( 1, n+4 ), work( 1, n+6 ),
586 sep( ks ) = scale / max( est, smlnum )
588 $ sep( ks+1 ) = sep( ks )
subroutine xerbla(srname, info)
subroutine dlacn2(n, v, x, isgn, est, kase, isave)
DLACN2 estimates the 1-norm of a square matrix, using reverse communication for evaluating matrix-vec...
subroutine dlacpy(uplo, m, n, a, lda, b, ldb)
DLACPY copies all or part of one two-dimensional array to another.
subroutine dlaqtr(ltran, lreal, n, t, ldt, b, w, scale, x, work, info)
DLAQTR solves a real quasi-triangular system of equations, or a complex quasi-triangular system of sp...
subroutine dtrexc(compq, n, t, ldt, q, ldq, ifst, ilst, work, info)
DTREXC
subroutine dtrsna(job, howmny, select, n, t, ldt, vl, ldvl, vr, ldvr, s, sep, mm, m, work, ldwork, iwork, info)
DTRSNA