248 SUBROUTINE ctrsna( JOB, HOWMNY, SELECT, N, T, LDT, VL, LDVL, VR,
249 $ ldvr, s, sep, mm, m, work, ldwork, rwork,
258 CHARACTER howmny, job
259 INTEGER info, ldt, ldvl, ldvr, ldwork, m, mm, n
263 REAL rwork( * ), s( * ), sep( * )
264 COMPLEX t( ldt, * ), vl( ldvl, * ), vr( ldvr, * ),
272 parameter( zero = 0.0e+0, one = 1.0+0 )
275 LOGICAL somcon, wantbh, wants, wantsp
277 INTEGER i, ierr, ix, j, k, kase, ks
278 REAL bignum, eps, est, lnrm, rnrm, scale, smlnum,
298 INTRINSIC abs, aimag, max, real
304 cabs1( cdum ) = abs(
REAL( CDUM ) ) + abs( aimag( cdum ) )
310 wantbh =
lsame( job,
'B' )
311 wants =
lsame( job,
'E' ) .OR. wantbh
312 wantsp =
lsame( job,
'V' ) .OR. wantbh
314 somcon =
lsame( howmny,
'S' )
330 IF( .NOT.wants .AND. .NOT.wantsp )
THEN
332 ELSE IF( .NOT.
lsame( howmny,
'A' ) .AND. .NOT.somcon )
THEN
334 ELSE IF( n.LT.0 )
THEN
336 ELSE IF( ldt.LT.max( 1, n ) )
THEN
338 ELSE IF( ldvl.LT.1 .OR. ( wants .AND. ldvl.LT.n ) )
THEN
340 ELSE IF( ldvr.LT.1 .OR. ( wants .AND. ldvr.LT.n ) )
THEN
342 ELSE IF( mm.LT.m )
THEN
344 ELSE IF( ldwork.LT.1 .OR. ( wantsp .AND. ldwork.LT.n ) )
THEN
348 CALL
xerbla(
'CTRSNA', -info )
359 IF( .NOT.
SELECT( 1 ) )
365 $ sep( 1 ) = abs( t( 1, 1 ) )
372 smlnum =
slamch(
'S' ) / eps
373 bignum = one / smlnum
374 CALL
slabad( smlnum, bignum )
380 IF( .NOT.
SELECT( k ) )
389 prod =
cdotc( n, vr( 1, ks ), 1, vl( 1, ks ), 1 )
390 rnrm =
scnrm2( n, vr( 1, ks ), 1 )
391 lnrm =
scnrm2( n, vl( 1, ks ), 1 )
392 s( ks ) = abs( prod ) / ( rnrm*lnrm )
404 CALL
clacpy(
'Full', n, n, t, ldt, work, ldwork )
405 CALL
ctrexc(
'No Q', n, work, ldwork, dummy, 1, k, 1, ierr )
410 work( i, i ) = work( i, i ) - work( 1, 1 )
421 CALL
clacn2( n-1, work( 1, n+1 ), work, est, kase, isave )
428 CALL
clatrs(
'Upper',
'Conjugate transpose',
429 $
'Nonunit', normin, n-1, work( 2, 2 ),
430 $ ldwork, work, scale, rwork, ierr )
435 CALL
clatrs(
'Upper',
'No transpose',
'Nonunit',
436 $ normin, n-1, work( 2, 2 ), ldwork, work,
437 $ scale, rwork, ierr )
440 IF( scale.NE.one )
THEN
445 ix =
icamax( n-1, work, 1 )
446 xnorm = cabs1( work( ix, 1 ) )
447 IF( scale.LT.xnorm*smlnum .OR. scale.EQ.zero )
449 CALL
csrscl( n, scale, work, 1 )
454 sep( ks ) = one / max( est, smlnum )