308 SUBROUTINE ctgsna( 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 REAL DIF( * ), S( * )
324 COMPLEX A( LDA, * ), B( LDB, * ), VL( LDVL, * ),
325 $ vr( ldvr, * ), work( * )
333 parameter( zero = 0.0e+0, one = 1.0e+0, idifjb = 3 )
336 LOGICAL LQUERY, SOMCON, WANTBH, WANTDF, WANTS
337 INTEGER I, IERR, IFST, ILST, K, KS, LWMIN, N1, N2
338 REAL BIGNUM, COND, EPS, LNRM, RNRM, SCALE, SMLNUM
342 COMPLEX DUMMY( 1 ), DUMMY1( 1 )
346 REAL SCNRM2, SLAMCH, SLAPY2, SROUNDUP_LWORK
348 EXTERNAL lsame, scnrm2, slamch, slapy2, sroundup_lwork,
355 INTRINSIC abs, cmplx, max
361 wantbh = lsame( job,
'B' )
362 wants = lsame( job,
'E' ) .OR. wantbh
363 wantdf = lsame( job,
'V' ) .OR. wantbh
365 somcon = lsame( howmny,
'S' )
368 lquery = ( lwork.EQ.-1 )
370 IF( .NOT.wants .AND. .NOT.wantdf )
THEN
372 ELSE IF( .NOT.lsame( howmny,
'A' ) .AND. .NOT.somcon )
THEN
374 ELSE IF( n.LT.0 )
THEN
376 ELSE IF( lda.LT.max( 1, n ) )
THEN
378 ELSE IF( ldb.LT.max( 1, n ) )
THEN
380 ELSE IF( wants .AND. ldvl.LT.n )
THEN
382 ELSE IF( wants .AND. ldvr.LT.n )
THEN
401 ELSE IF( lsame( job,
'V' ) .OR. lsame( job,
'B' ) )
THEN
406 work( 1 ) = sroundup_lwork(lwmin)
410 ELSE IF( lwork.LT.lwmin .AND. .NOT.lquery )
THEN
416 CALL xerbla(
'CTGSNA', -info )
418 ELSE IF( lquery )
THEN
430 smlnum = slamch(
'S' ) / eps
431 bignum = one / smlnum
439 IF( .NOT.
SELECT( k ) )
450 rnrm = scnrm2( n, vr( 1, ks ), 1 )
451 lnrm = scnrm2( n, vl( 1, ks ), 1 )
452 CALL cgemv(
'N', n, n, cmplx( one, zero ), a, lda,
453 $ vr( 1, ks ), 1, cmplx( zero, zero ), work, 1 )
454 yhax = cdotc( n, work, 1, vl( 1, ks ), 1 )
455 CALL cgemv(
'N', n, n, cmplx( one, zero ), b, ldb,
456 $ vr( 1, ks ), 1, cmplx( zero, zero ), work, 1 )
457 yhbx = cdotc( n, work, 1, vl( 1, ks ), 1 )
458 cond = slapy2( abs( yhax ), abs( yhbx ) )
459 IF( cond.EQ.zero )
THEN
462 s( ks ) = cond / ( rnrm*lnrm )
468 dif( ks ) = slapy2( abs( a( 1, 1 ) ), abs( b( 1, 1 ) ) )
477 CALL clacpy(
'Full', n, n, a, lda, work, n )
478 CALL clacpy(
'Full', n, n, b, ldb, work( n*n+1 ), n )
482 CALL ctgexc( .false., .false., n, work, n, work( n*n+1 ),
483 $ n, dummy, 1, dummy1, 1, ifst, ilst, ierr )
501 CALL ctgsyl(
'N', idifjb, n2, n1, work( n*n1+n1+1 ),
502 $ n, work, n, work( n1+1 ), n,
503 $ work( n*n1+n1+i ), n, work( i ), n,
504 $ work( n1+i ), n, scale, dif( ks ), dummy,
511 work( 1 ) = sroundup_lwork(lwmin)
subroutine xerbla(srname, info)
subroutine cgemv(trans, m, n, alpha, a, lda, x, incx, beta, y, incy)
CGEMV
subroutine clacpy(uplo, m, n, a, lda, b, ldb)
CLACPY copies all or part of one two-dimensional array to another.
subroutine ctgexc(wantq, wantz, n, a, lda, b, ldb, q, ldq, z, ldz, ifst, ilst, info)
CTGEXC
subroutine ctgsna(job, howmny, select, n, a, lda, b, ldb, vl, ldvl, vr, ldvr, s, dif, mm, m, work, lwork, iwork, info)
CTGSNA
subroutine ctgsyl(trans, ijob, m, n, a, lda, b, ldb, c, ldc, d, ldd, e, lde, f, ldf, scale, dif, work, lwork, iwork, info)
CTGSYL