313 SUBROUTINE dtrsen( JOB, COMPQ, SELECT, N, T, LDT, Q, LDQ, WR, WI,
314 $ m, s, sep, work, lwork, iwork, liwork, info )
323 INTEGER info, ldq, ldt, liwork, lwork, m, n
324 DOUBLE PRECISION s, sep
329 DOUBLE PRECISION q( ldq, * ), t( ldt, * ), wi( * ), work( * ),
336 DOUBLE PRECISION zero, one
337 parameter( zero = 0.0d+0, one = 1.0d+0 )
340 LOGICAL lquery, pair, swap, wantbh, wantq, wants,
342 INTEGER ierr, k, kase, kk, ks, liwmin, lwmin, n1, n2,
344 DOUBLE PRECISION est, rnorm, scale
358 INTRINSIC abs, max, sqrt
364 wantbh =
lsame( job,
'B' )
365 wants =
lsame( job,
'E' ) .OR. wantbh
366 wantsp =
lsame( job,
'V' ) .OR. wantbh
367 wantq =
lsame( compq,
'V' )
370 lquery = ( lwork.EQ.-1 )
371 IF( .NOT.
lsame( job,
'N' ) .AND. .NOT.wants .AND. .NOT.wantsp )
374 ELSE IF( .NOT.
lsame( compq,
'N' ) .AND. .NOT.wantq )
THEN
376 ELSE IF( n.LT.0 )
THEN
378 ELSE IF( ldt.LT.max( 1, n ) )
THEN
380 ELSE IF( ldq.LT.1 .OR. ( wantq .AND. ldq.LT.n ) )
THEN
394 IF( t( k+1, k ).EQ.zero )
THEN
399 IF(
SELECT( k ) .OR.
SELECT( k+1 ) )
414 lwmin = max( 1, 2*nn )
415 liwmin = max( 1, nn )
416 ELSE IF(
lsame( job,
'N' ) )
THEN
419 ELSE IF(
lsame( job,
'E' ) )
THEN
424 IF( lwork.LT.lwmin .AND. .NOT.lquery )
THEN
426 ELSE IF( liwork.LT.liwmin .AND. .NOT.lquery )
THEN
437 CALL
xerbla(
'DTRSEN', -info )
439 ELSE IF( lquery )
THEN
445 IF( m.EQ.n .OR. m.EQ.0 )
THEN
449 $ sep =
dlange(
'1', n, n, t, ldt, work )
463 IF( t( k+1, k ).NE.zero )
THEN
465 swap = swap .OR.
SELECT( k+1 )
476 $ CALL
dtrexc( compq, n, t, ldt, q, ldq, kk, ks, work,
478 IF( ierr.EQ.1 .OR. ierr.EQ.2 )
THEN
501 CALL
dlacpy(
'F', n1, n2, t( 1, n1+1 ), ldt, work, n1 )
502 CALL
dtrsyl(
'N',
'N', -1, n1, n2, t, ldt, t( n1+1, n1+1 ),
503 $ ldt, work, n1, scale, ierr )
508 rnorm =
dlange(
'F', n1, n2, work, n1, work )
509 IF( rnorm.EQ.zero )
THEN
512 s = scale / ( sqrt( scale*scale / rnorm+rnorm )*
524 CALL
dlacn2( nn, work( nn+1 ), work, iwork, est, kase, isave )
530 CALL
dtrsyl(
'N',
'N', -1, n1, n2, t, ldt,
531 $ t( n1+1, n1+1 ), ldt, work, n1, scale,
537 CALL
dtrsyl(
'T',
'T', -1, n1, n2, t, ldt,
538 $ t( n1+1, n1+1 ), ldt, work, n1, scale,
556 IF( t( k+1, k ).NE.zero )
THEN
557 wi( k ) = sqrt( abs( t( k, k+1 ) ) )*
558 $ sqrt( abs( t( k+1, k ) ) )