308 SUBROUTINE ztgsna( JOB, HOWMNY, SELECT, N, A, LDA, B, LDB, VL,
309 $ LDVL, VR, LDVR, S, DIF, MM, M, WORK, LWORK,
317 CHARACTER HOWMNY, JOB
318 INTEGER INFO, LDA, LDB, LDVL, LDVR, LWORK, M, MM, N
323 DOUBLE PRECISION DIF( * ), S( * )
324 COMPLEX*16 A( LDA, * ), B( LDB, * ), VL( LDVL, * ),
325 $ vr( ldvr, * ), work( * )
331 DOUBLE PRECISION ZERO, ONE
333 parameter( zero = 0.0d+0, one = 1.0d+0, idifjb = 3 )
336 LOGICAL LQUERY, SOMCON, WANTBH, WANTDF, WANTS
337 INTEGER I, IERR, IFST, ILST, K, KS, LWMIN, N1, N2
338 DOUBLE PRECISION BIGNUM, COND, EPS, LNRM, RNRM, SCALE, SMLNUM
339 COMPLEX*16 YHAX, YHBX
342 COMPLEX*16 DUMMY( 1 ), DUMMY1( 1 )
346 DOUBLE PRECISION DLAMCH, DLAPY2, DZNRM2
348 EXTERNAL lsame, dlamch, dlapy2, dznrm2, zdotc
354 INTRINSIC abs, dcmplx, max
360 wantbh = lsame( job,
'B' )
361 wants = lsame( job,
'E' ) .OR. wantbh
362 wantdf = lsame( job,
'V' ) .OR. wantbh
364 somcon = lsame( howmny,
'S' )
367 lquery = ( lwork.EQ.-1 )
369 IF( .NOT.wants .AND. .NOT.wantdf )
THEN
371 ELSE IF( .NOT.lsame( howmny,
'A' ) .AND. .NOT.somcon )
THEN
373 ELSE IF( n.LT.0 )
THEN
375 ELSE IF( lda.LT.max( 1, n ) )
THEN
377 ELSE IF( ldb.LT.max( 1, n ) )
THEN
379 ELSE IF( wants .AND. ldvl.LT.n )
THEN
381 ELSE IF( wants .AND. ldvr.LT.n )
THEN
400 ELSE IF( lsame( job,
'V' ) .OR. lsame( job,
'B' ) )
THEN
409 ELSE IF( lwork.LT.lwmin .AND. .NOT.lquery )
THEN
415 CALL xerbla(
'ZTGSNA', -info )
417 ELSE IF( lquery )
THEN
429 smlnum = dlamch(
'S' ) / eps
430 bignum = one / smlnum
438 IF( .NOT.
SELECT( k ) )
449 rnrm = dznrm2( n, vr( 1, ks ), 1 )
450 lnrm = dznrm2( n, vl( 1, ks ), 1 )
451 CALL zgemv(
'N', n, n, dcmplx( one, zero ), a, lda,
452 $ vr( 1, ks ), 1, dcmplx( zero, zero ), work, 1 )
453 yhax = zdotc( n, work, 1, vl( 1, ks ), 1 )
454 CALL zgemv(
'N', n, n, dcmplx( one, zero ), b, ldb,
455 $ vr( 1, ks ), 1, dcmplx( zero, zero ), work, 1 )
456 yhbx = zdotc( n, work, 1, vl( 1, ks ), 1 )
457 cond = dlapy2( abs( yhax ), abs( yhbx ) )
458 IF( cond.EQ.zero )
THEN
461 s( ks ) = cond / ( rnrm*lnrm )
467 dif( ks ) = dlapy2( abs( a( 1, 1 ) ), abs( b( 1, 1 ) ) )
476 CALL zlacpy(
'Full', n, n, a, lda, work, n )
477 CALL zlacpy(
'Full', n, n, b, ldb, work( n*n+1 ), n )
481 CALL ztgexc( .false., .false., n, work, n, work( n*n+1 ),
482 $ n, dummy, 1, dummy1, 1, ifst, ilst, ierr )
500 CALL ztgsyl(
'N', idifjb, n2, n1, work( n*n1+n1+1 ),
501 $ n, work, n, work( n1+1 ), n,
502 $ work( n*n1+n1+i ), n, work( i ), n,
503 $ work( n1+i ), n, scale, dif( ks ), dummy,
subroutine xerbla(srname, info)
subroutine zgemv(trans, m, n, alpha, a, lda, x, incx, beta, y, incy)
ZGEMV
subroutine zlacpy(uplo, m, n, a, lda, b, ldb)
ZLACPY copies all or part of one two-dimensional array to another.
subroutine ztgexc(wantq, wantz, n, a, lda, b, ldb, q, ldq, z, ldz, ifst, ilst, info)
ZTGEXC
subroutine ztgsna(job, howmny, select, n, a, lda, b, ldb, vl, ldvl, vr, ldvr, s, dif, mm, m, work, lwork, iwork, info)
ZTGSNA
subroutine ztgsyl(trans, ijob, m, n, a, lda, b, ldb, c, ldc, d, ldd, e, lde, f, ldf, scale, dif, work, lwork, iwork, info)
ZTGSYL