264 SUBROUTINE ztrsen( JOB, COMPQ, SELECT, N, T, LDT, Q, LDQ, W, M, S,
265 $ sep, work, lwork, info )
274 INTEGER info, ldq, ldt, lwork, m, n
275 DOUBLE PRECISION s, sep
279 COMPLEX*16 q( ldq, * ), t( ldt, * ), w( * ), work( * )
285 DOUBLE PRECISION zero, one
286 parameter( zero = 0.0d+0, one = 1.0d+0 )
289 LOGICAL lquery, wantbh, wantq, wants, wantsp
290 INTEGER ierr, k, kase, ks, lwmin, n1, n2, nn
291 DOUBLE PRECISION est, rnorm, scale
295 DOUBLE PRECISION rwork( 1 )
312 wantbh =
lsame( job,
'B' )
313 wants =
lsame( job,
'E' ) .OR. wantbh
314 wantsp =
lsame( job,
'V' ) .OR. wantbh
315 wantq =
lsame( compq,
'V' )
330 lquery = ( lwork.EQ.-1 )
333 lwmin = max( 1, 2*nn )
334 ELSE IF(
lsame( job,
'N' ) )
THEN
336 ELSE IF(
lsame( job,
'E' ) )
THEN
340 IF( .NOT.
lsame( job,
'N' ) .AND. .NOT.wants .AND. .NOT.wantsp )
343 ELSE IF( .NOT.
lsame( compq,
'N' ) .AND. .NOT.wantq )
THEN
345 ELSE IF( n.LT.0 )
THEN
347 ELSE IF( ldt.LT.max( 1, n ) )
THEN
349 ELSE IF( ldq.LT.1 .OR. ( wantq .AND. ldq.LT.n ) )
THEN
351 ELSE IF( lwork.LT.lwmin .AND. .NOT.lquery )
THEN
360 CALL
xerbla(
'ZTRSEN', -info )
362 ELSE IF( lquery )
THEN
368 IF( m.EQ.n .OR. m.EQ.0 )
THEN
372 $ sep =
zlange(
'1', n, n, t, ldt, rwork )
380 IF(
SELECT( k ) )
THEN
386 $ CALL
ztrexc( compq, n, t, ldt, q, ldq, k, ks, ierr )
396 CALL
zlacpy(
'F', n1, n2, t( 1, n1+1 ), ldt, work, n1 )
397 CALL
ztrsyl(
'N',
'N', -1, n1, n2, t, ldt, t( n1+1, n1+1 ),
398 $ ldt, work, n1, scale, ierr )
403 rnorm =
zlange(
'F', n1, n2, work, n1, rwork )
404 IF( rnorm.EQ.zero )
THEN
407 s = scale / ( sqrt( scale*scale / rnorm+rnorm )*
419 CALL
zlacn2( nn, work( nn+1 ), work, est, kase, isave )
425 CALL
ztrsyl(
'N',
'N', -1, n1, n2, t, ldt,
426 $ t( n1+1, n1+1 ), ldt, work, n1, scale,
432 CALL
ztrsyl(
'C',
'C', -1, n1, n2, t, ldt,
433 $ t( n1+1, n1+1 ), ldt, work, n1, scale,