LAPACK  3.10.1
LAPACK: Linear Algebra PACKage

◆ cggevx()

subroutine cggevx ( character  BALANC,
character  JOBVL,
character  JOBVR,
character  SENSE,
integer  N,
complex, dimension( lda, * )  A,
integer  LDA,
complex, dimension( ldb, * )  B,
integer  LDB,
complex, dimension( * )  ALPHA,
complex, dimension( * )  BETA,
complex, dimension( ldvl, * )  VL,
integer  LDVL,
complex, dimension( ldvr, * )  VR,
integer  LDVR,
integer  ILO,
integer  IHI,
real, dimension( * )  LSCALE,
real, dimension( * )  RSCALE,
real  ABNRM,
real  BBNRM,
real, dimension( * )  RCONDE,
real, dimension( * )  RCONDV,
complex, dimension( * )  WORK,
integer  LWORK,
real, dimension( * )  RWORK,
integer, dimension( * )  IWORK,
logical, dimension( * )  BWORK,
integer  INFO 
)

CGGEVX computes the eigenvalues and, optionally, the left and/or right eigenvectors for GE matrices

Download CGGEVX + dependencies [TGZ] [ZIP] [TXT]

Purpose:
 CGGEVX computes for a pair of N-by-N complex nonsymmetric matrices
 (A,B) the generalized eigenvalues, and optionally, the left and/or
 right generalized eigenvectors.

 Optionally, it also computes a balancing transformation to improve
 the conditioning of the eigenvalues and eigenvectors (ILO, IHI,
 LSCALE, RSCALE, ABNRM, and BBNRM), reciprocal condition numbers for
 the eigenvalues (RCONDE), and reciprocal condition numbers for the
 right eigenvectors (RCONDV).

 A generalized eigenvalue for a pair of matrices (A,B) is a scalar
 lambda or a ratio alpha/beta = lambda, such that A - lambda*B is
 singular. It is usually represented as the pair (alpha,beta), as
 there is a reasonable interpretation for beta=0, and even for both
 being zero.

 The right eigenvector v(j) corresponding to the eigenvalue lambda(j)
 of (A,B) satisfies
                  A * v(j) = lambda(j) * B * v(j) .
 The left eigenvector u(j) corresponding to the eigenvalue lambda(j)
 of (A,B) satisfies
                  u(j)**H * A  = lambda(j) * u(j)**H * B.
 where u(j)**H is the conjugate-transpose of u(j).
Parameters
[in]BALANC
          BALANC is CHARACTER*1
          Specifies the balance option to be performed:
          = 'N':  do not diagonally scale or permute;
          = 'P':  permute only;
          = 'S':  scale only;
          = 'B':  both permute and scale.
          Computed reciprocal condition numbers will be for the
          matrices after permuting and/or balancing. Permuting does
          not change condition numbers (in exact arithmetic), but
          balancing does.
[in]JOBVL
          JOBVL is CHARACTER*1
          = 'N':  do not compute the left generalized eigenvectors;
          = 'V':  compute the left generalized eigenvectors.
[in]JOBVR
          JOBVR is CHARACTER*1
          = 'N':  do not compute the right generalized eigenvectors;
          = 'V':  compute the right generalized eigenvectors.
[in]SENSE
          SENSE is CHARACTER*1
          Determines which reciprocal condition numbers are computed.
          = 'N': none are computed;
          = 'E': computed for eigenvalues only;
          = 'V': computed for eigenvectors only;
          = 'B': computed for eigenvalues and eigenvectors.
[in]N
          N is INTEGER
          The order of the matrices A, B, VL, and VR.  N >= 0.
[in,out]A
          A is COMPLEX array, dimension (LDA, N)
          On entry, the matrix A in the pair (A,B).
          On exit, A has been overwritten. If JOBVL='V' or JOBVR='V'
          or both, then A contains the first part of the complex Schur
          form of the "balanced" versions of the input A and B.
[in]LDA
          LDA is INTEGER
          The leading dimension of A.  LDA >= max(1,N).
[in,out]B
          B is COMPLEX array, dimension (LDB, N)
          On entry, the matrix B in the pair (A,B).
          On exit, B has been overwritten. If JOBVL='V' or JOBVR='V'
          or both, then B contains the second part of the complex
          Schur form of the "balanced" versions of the input A and B.
[in]LDB
          LDB is INTEGER
          The leading dimension of B.  LDB >= max(1,N).
[out]ALPHA
          ALPHA is COMPLEX array, dimension (N)
[out]BETA
          BETA is COMPLEX array, dimension (N)
          On exit, ALPHA(j)/BETA(j), j=1,...,N, will be the generalized
          eigenvalues.

          Note: the quotient ALPHA(j)/BETA(j) ) may easily over- or
          underflow, and BETA(j) may even be zero.  Thus, the user
          should avoid naively computing the ratio ALPHA/BETA.
          However, ALPHA will be always less than and usually
          comparable with norm(A) in magnitude, and BETA always less
          than and usually comparable with norm(B).
[out]VL
          VL is COMPLEX array, dimension (LDVL,N)
          If JOBVL = 'V', the left generalized eigenvectors u(j) are
          stored one after another in the columns of VL, in the same
          order as their eigenvalues.
          Each eigenvector will be scaled so the largest component
          will have abs(real part) + abs(imag. part) = 1.
          Not referenced if JOBVL = 'N'.
[in]LDVL
          LDVL is INTEGER
          The leading dimension of the matrix VL. LDVL >= 1, and
          if JOBVL = 'V', LDVL >= N.
[out]VR
          VR is COMPLEX array, dimension (LDVR,N)
          If JOBVR = 'V', the right generalized eigenvectors v(j) are
          stored one after another in the columns of VR, in the same
          order as their eigenvalues.
          Each eigenvector will be scaled so the largest component
          will have abs(real part) + abs(imag. part) = 1.
          Not referenced if JOBVR = 'N'.
[in]LDVR
          LDVR is INTEGER
          The leading dimension of the matrix VR. LDVR >= 1, and
          if JOBVR = 'V', LDVR >= N.
[out]ILO
          ILO is INTEGER
[out]IHI
          IHI is INTEGER
          ILO and IHI are integer values such that on exit
          A(i,j) = 0 and B(i,j) = 0 if i > j and
          j = 1,...,ILO-1 or i = IHI+1,...,N.
          If BALANC = 'N' or 'S', ILO = 1 and IHI = N.
[out]LSCALE
          LSCALE is REAL array, dimension (N)
          Details of the permutations and scaling factors applied
          to the left side of A and B.  If PL(j) is the index of the
          row interchanged with row j, and DL(j) is the scaling
          factor applied to row j, then
            LSCALE(j) = PL(j)  for j = 1,...,ILO-1
                      = DL(j)  for j = ILO,...,IHI
                      = PL(j)  for j = IHI+1,...,N.
          The order in which the interchanges are made is N to IHI+1,
          then 1 to ILO-1.
[out]RSCALE
          RSCALE is REAL array, dimension (N)
          Details of the permutations and scaling factors applied
          to the right side of A and B.  If PR(j) is the index of the
          column interchanged with column j, and DR(j) is the scaling
          factor applied to column j, then
            RSCALE(j) = PR(j)  for j = 1,...,ILO-1
                      = DR(j)  for j = ILO,...,IHI
                      = PR(j)  for j = IHI+1,...,N
          The order in which the interchanges are made is N to IHI+1,
          then 1 to ILO-1.
[out]ABNRM
          ABNRM is REAL
          The one-norm of the balanced matrix A.
[out]BBNRM
          BBNRM is REAL
          The one-norm of the balanced matrix B.
[out]RCONDE
          RCONDE is REAL array, dimension (N)
          If SENSE = 'E' or 'B', the reciprocal condition numbers of
          the eigenvalues, stored in consecutive elements of the array.
          If SENSE = 'N' or 'V', RCONDE is not referenced.
[out]RCONDV
          RCONDV is REAL array, dimension (N)
          If SENSE = 'V' or 'B', the estimated reciprocal condition
          numbers of the eigenvectors, stored in consecutive elements
          of the array. If the eigenvalues cannot be reordered to
          compute RCONDV(j), RCONDV(j) is set to 0; this can only occur
          when the true value would be very small anyway.
          If SENSE = 'N' or 'E', RCONDV is not referenced.
[out]WORK
          WORK is COMPLEX array, dimension (MAX(1,LWORK))
          On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
[in]LWORK
          LWORK is INTEGER
          The dimension of the array WORK. LWORK >= max(1,2*N).
          If SENSE = 'E', LWORK >= max(1,4*N).
          If SENSE = 'V' or 'B', LWORK >= max(1,2*N*N+2*N).

          If LWORK = -1, then a workspace query is assumed; the routine
          only calculates the optimal size of the WORK array, returns
          this value as the first entry of the WORK array, and no error
          message related to LWORK is issued by XERBLA.
[out]RWORK
          RWORK is REAL array, dimension (lrwork)
          lrwork must be at least max(1,6*N) if BALANC = 'S' or 'B',
          and at least max(1,2*N) otherwise.
          Real workspace.
[out]IWORK
          IWORK is INTEGER array, dimension (N+2)
          If SENSE = 'E', IWORK is not referenced.
[out]BWORK
          BWORK is LOGICAL array, dimension (N)
          If SENSE = 'N', BWORK is not referenced.
[out]INFO
          INFO is INTEGER
          = 0:  successful exit
          < 0:  if INFO = -i, the i-th argument had an illegal value.
          = 1,...,N:
                The QZ iteration failed.  No eigenvectors have been
                calculated, but ALPHA(j) and BETA(j) should be correct
                for j=INFO+1,...,N.
          > N:  =N+1: other than QZ iteration failed in CHGEQZ.
                =N+2: error return from CTGEVC.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Further Details:
  Balancing a matrix pair (A,B) includes, first, permuting rows and
  columns to isolate eigenvalues, second, applying diagonal similarity
  transformation to the rows and columns to make the rows and columns
  as close in norm as possible. The computed reciprocal condition
  numbers correspond to the balanced matrix. Permuting rows and columns
  will not change the condition numbers (in exact arithmetic) but
  diagonal scaling will.  For further explanation of balancing, see
  section 4.11.1.2 of LAPACK Users' Guide.

  An approximate error bound on the chordal distance between the i-th
  computed generalized eigenvalue w and the corresponding exact
  eigenvalue lambda is

       chord(w, lambda) <= EPS * norm(ABNRM, BBNRM) / RCONDE(I)

  An approximate error bound for the angle between the i-th computed
  eigenvector VL(i) or VR(i) is given by

       EPS * norm(ABNRM, BBNRM) / DIF(i).

  For further explanation of the reciprocal condition numbers RCONDE
  and RCONDV, see section 4.11 of LAPACK User's Guide.

Definition at line 370 of file cggevx.f.

374 *
375 * -- LAPACK driver routine --
376 * -- LAPACK is a software package provided by Univ. of Tennessee, --
377 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
378 *
379 * .. Scalar Arguments ..
380  CHARACTER BALANC, JOBVL, JOBVR, SENSE
381  INTEGER IHI, ILO, INFO, LDA, LDB, LDVL, LDVR, LWORK, N
382  REAL ABNRM, BBNRM
383 * ..
384 * .. Array Arguments ..
385  LOGICAL BWORK( * )
386  INTEGER IWORK( * )
387  REAL LSCALE( * ), RCONDE( * ), RCONDV( * ),
388  $ RSCALE( * ), RWORK( * )
389  COMPLEX A( LDA, * ), ALPHA( * ), B( LDB, * ),
390  $ BETA( * ), VL( LDVL, * ), VR( LDVR, * ),
391  $ WORK( * )
392 * ..
393 *
394 * =====================================================================
395 *
396 * .. Parameters ..
397  REAL ZERO, ONE
398  parameter( zero = 0.0e+0, one = 1.0e+0 )
399  COMPLEX CZERO, CONE
400  parameter( czero = ( 0.0e+0, 0.0e+0 ),
401  $ cone = ( 1.0e+0, 0.0e+0 ) )
402 * ..
403 * .. Local Scalars ..
404  LOGICAL ILASCL, ILBSCL, ILV, ILVL, ILVR, LQUERY, NOSCL,
405  $ WANTSB, WANTSE, WANTSN, WANTSV
406  CHARACTER CHTEMP
407  INTEGER I, ICOLS, IERR, IJOBVL, IJOBVR, IN, IROWS,
408  $ ITAU, IWRK, IWRK1, J, JC, JR, M, MAXWRK, MINWRK
409  REAL ANRM, ANRMTO, BIGNUM, BNRM, BNRMTO, EPS,
410  $ SMLNUM, TEMP
411  COMPLEX X
412 * ..
413 * .. Local Arrays ..
414  LOGICAL LDUMMA( 1 )
415 * ..
416 * .. External Subroutines ..
417  EXTERNAL cgeqrf, cggbak, cggbal, cgghrd, chgeqz, clacpy,
419  $ slabad, slascl, xerbla
420 * ..
421 * .. External Functions ..
422  LOGICAL LSAME
423  INTEGER ILAENV
424  REAL CLANGE, SLAMCH
425  EXTERNAL lsame, ilaenv, clange, slamch
426 * ..
427 * .. Intrinsic Functions ..
428  INTRINSIC abs, aimag, max, real, sqrt
429 * ..
430 * .. Statement Functions ..
431  REAL ABS1
432 * ..
433 * .. Statement Function definitions ..
434  abs1( x ) = abs( real( x ) ) + abs( aimag( x ) )
435 * ..
436 * .. Executable Statements ..
437 *
438 * Decode the input arguments
439 *
440  IF( lsame( jobvl, 'N' ) ) THEN
441  ijobvl = 1
442  ilvl = .false.
443  ELSE IF( lsame( jobvl, 'V' ) ) THEN
444  ijobvl = 2
445  ilvl = .true.
446  ELSE
447  ijobvl = -1
448  ilvl = .false.
449  END IF
450 *
451  IF( lsame( jobvr, 'N' ) ) THEN
452  ijobvr = 1
453  ilvr = .false.
454  ELSE IF( lsame( jobvr, 'V' ) ) THEN
455  ijobvr = 2
456  ilvr = .true.
457  ELSE
458  ijobvr = -1
459  ilvr = .false.
460  END IF
461  ilv = ilvl .OR. ilvr
462 *
463  noscl = lsame( balanc, 'N' ) .OR. lsame( balanc, 'P' )
464  wantsn = lsame( sense, 'N' )
465  wantse = lsame( sense, 'E' )
466  wantsv = lsame( sense, 'V' )
467  wantsb = lsame( sense, 'B' )
468 *
469 * Test the input arguments
470 *
471  info = 0
472  lquery = ( lwork.EQ.-1 )
473  IF( .NOT.( noscl .OR. lsame( balanc,'S' ) .OR.
474  $ lsame( balanc, 'B' ) ) ) THEN
475  info = -1
476  ELSE IF( ijobvl.LE.0 ) THEN
477  info = -2
478  ELSE IF( ijobvr.LE.0 ) THEN
479  info = -3
480  ELSE IF( .NOT.( wantsn .OR. wantse .OR. wantsb .OR. wantsv ) )
481  $ THEN
482  info = -4
483  ELSE IF( n.LT.0 ) THEN
484  info = -5
485  ELSE IF( lda.LT.max( 1, n ) ) THEN
486  info = -7
487  ELSE IF( ldb.LT.max( 1, n ) ) THEN
488  info = -9
489  ELSE IF( ldvl.LT.1 .OR. ( ilvl .AND. ldvl.LT.n ) ) THEN
490  info = -13
491  ELSE IF( ldvr.LT.1 .OR. ( ilvr .AND. ldvr.LT.n ) ) THEN
492  info = -15
493  END IF
494 *
495 * Compute workspace
496 * (Note: Comments in the code beginning "Workspace:" describe the
497 * minimal amount of workspace needed at that point in the code,
498 * as well as the preferred amount for good performance.
499 * NB refers to the optimal block size for the immediately
500 * following subroutine, as returned by ILAENV. The workspace is
501 * computed assuming ILO = 1 and IHI = N, the worst case.)
502 *
503  IF( info.EQ.0 ) THEN
504  IF( n.EQ.0 ) THEN
505  minwrk = 1
506  maxwrk = 1
507  ELSE
508  minwrk = 2*n
509  IF( wantse ) THEN
510  minwrk = 4*n
511  ELSE IF( wantsv .OR. wantsb ) THEN
512  minwrk = 2*n*( n + 1)
513  END IF
514  maxwrk = minwrk
515  maxwrk = max( maxwrk,
516  $ n + n*ilaenv( 1, 'CGEQRF', ' ', n, 1, n, 0 ) )
517  maxwrk = max( maxwrk,
518  $ n + n*ilaenv( 1, 'CUNMQR', ' ', n, 1, n, 0 ) )
519  IF( ilvl ) THEN
520  maxwrk = max( maxwrk, n +
521  $ n*ilaenv( 1, 'CUNGQR', ' ', n, 1, n, 0 ) )
522  END IF
523  END IF
524  work( 1 ) = maxwrk
525 *
526  IF( lwork.LT.minwrk .AND. .NOT.lquery ) THEN
527  info = -25
528  END IF
529  END IF
530 *
531  IF( info.NE.0 ) THEN
532  CALL xerbla( 'CGGEVX', -info )
533  RETURN
534  ELSE IF( lquery ) THEN
535  RETURN
536  END IF
537 *
538 * Quick return if possible
539 *
540  IF( n.EQ.0 )
541  $ RETURN
542 *
543 * Get machine constants
544 *
545  eps = slamch( 'P' )
546  smlnum = slamch( 'S' )
547  bignum = one / smlnum
548  CALL slabad( smlnum, bignum )
549  smlnum = sqrt( smlnum ) / eps
550  bignum = one / smlnum
551 *
552 * Scale A if max element outside range [SMLNUM,BIGNUM]
553 *
554  anrm = clange( 'M', n, n, a, lda, rwork )
555  ilascl = .false.
556  IF( anrm.GT.zero .AND. anrm.LT.smlnum ) THEN
557  anrmto = smlnum
558  ilascl = .true.
559  ELSE IF( anrm.GT.bignum ) THEN
560  anrmto = bignum
561  ilascl = .true.
562  END IF
563  IF( ilascl )
564  $ CALL clascl( 'G', 0, 0, anrm, anrmto, n, n, a, lda, ierr )
565 *
566 * Scale B if max element outside range [SMLNUM,BIGNUM]
567 *
568  bnrm = clange( 'M', n, n, b, ldb, rwork )
569  ilbscl = .false.
570  IF( bnrm.GT.zero .AND. bnrm.LT.smlnum ) THEN
571  bnrmto = smlnum
572  ilbscl = .true.
573  ELSE IF( bnrm.GT.bignum ) THEN
574  bnrmto = bignum
575  ilbscl = .true.
576  END IF
577  IF( ilbscl )
578  $ CALL clascl( 'G', 0, 0, bnrm, bnrmto, n, n, b, ldb, ierr )
579 *
580 * Permute and/or balance the matrix pair (A,B)
581 * (Real Workspace: need 6*N if BALANC = 'S' or 'B', 1 otherwise)
582 *
583  CALL cggbal( balanc, n, a, lda, b, ldb, ilo, ihi, lscale, rscale,
584  $ rwork, ierr )
585 *
586 * Compute ABNRM and BBNRM
587 *
588  abnrm = clange( '1', n, n, a, lda, rwork( 1 ) )
589  IF( ilascl ) THEN
590  rwork( 1 ) = abnrm
591  CALL slascl( 'G', 0, 0, anrmto, anrm, 1, 1, rwork( 1 ), 1,
592  $ ierr )
593  abnrm = rwork( 1 )
594  END IF
595 *
596  bbnrm = clange( '1', n, n, b, ldb, rwork( 1 ) )
597  IF( ilbscl ) THEN
598  rwork( 1 ) = bbnrm
599  CALL slascl( 'G', 0, 0, bnrmto, bnrm, 1, 1, rwork( 1 ), 1,
600  $ ierr )
601  bbnrm = rwork( 1 )
602  END IF
603 *
604 * Reduce B to triangular form (QR decomposition of B)
605 * (Complex Workspace: need N, prefer N*NB )
606 *
607  irows = ihi + 1 - ilo
608  IF( ilv .OR. .NOT.wantsn ) THEN
609  icols = n + 1 - ilo
610  ELSE
611  icols = irows
612  END IF
613  itau = 1
614  iwrk = itau + irows
615  CALL cgeqrf( irows, icols, b( ilo, ilo ), ldb, work( itau ),
616  $ work( iwrk ), lwork+1-iwrk, ierr )
617 *
618 * Apply the unitary transformation to A
619 * (Complex Workspace: need N, prefer N*NB)
620 *
621  CALL cunmqr( 'L', 'C', irows, icols, irows, b( ilo, ilo ), ldb,
622  $ work( itau ), a( ilo, ilo ), lda, work( iwrk ),
623  $ lwork+1-iwrk, ierr )
624 *
625 * Initialize VL and/or VR
626 * (Workspace: need N, prefer N*NB)
627 *
628  IF( ilvl ) THEN
629  CALL claset( 'Full', n, n, czero, cone, vl, ldvl )
630  IF( irows.GT.1 ) THEN
631  CALL clacpy( 'L', irows-1, irows-1, b( ilo+1, ilo ), ldb,
632  $ vl( ilo+1, ilo ), ldvl )
633  END IF
634  CALL cungqr( irows, irows, irows, vl( ilo, ilo ), ldvl,
635  $ work( itau ), work( iwrk ), lwork+1-iwrk, ierr )
636  END IF
637 *
638  IF( ilvr )
639  $ CALL claset( 'Full', n, n, czero, cone, vr, ldvr )
640 *
641 * Reduce to generalized Hessenberg form
642 * (Workspace: none needed)
643 *
644  IF( ilv .OR. .NOT.wantsn ) THEN
645 *
646 * Eigenvectors requested -- work on whole matrix.
647 *
648  CALL cgghrd( jobvl, jobvr, n, ilo, ihi, a, lda, b, ldb, vl,
649  $ ldvl, vr, ldvr, ierr )
650  ELSE
651  CALL cgghrd( 'N', 'N', irows, 1, irows, a( ilo, ilo ), lda,
652  $ b( ilo, ilo ), ldb, vl, ldvl, vr, ldvr, ierr )
653  END IF
654 *
655 * Perform QZ algorithm (Compute eigenvalues, and optionally, the
656 * Schur forms and Schur vectors)
657 * (Complex Workspace: need N)
658 * (Real Workspace: need N)
659 *
660  iwrk = itau
661  IF( ilv .OR. .NOT.wantsn ) THEN
662  chtemp = 'S'
663  ELSE
664  chtemp = 'E'
665  END IF
666 *
667  CALL chgeqz( chtemp, jobvl, jobvr, n, ilo, ihi, a, lda, b, ldb,
668  $ alpha, beta, vl, ldvl, vr, ldvr, work( iwrk ),
669  $ lwork+1-iwrk, rwork, ierr )
670  IF( ierr.NE.0 ) THEN
671  IF( ierr.GT.0 .AND. ierr.LE.n ) THEN
672  info = ierr
673  ELSE IF( ierr.GT.n .AND. ierr.LE.2*n ) THEN
674  info = ierr - n
675  ELSE
676  info = n + 1
677  END IF
678  GO TO 90
679  END IF
680 *
681 * Compute Eigenvectors and estimate condition numbers if desired
682 * CTGEVC: (Complex Workspace: need 2*N )
683 * (Real Workspace: need 2*N )
684 * CTGSNA: (Complex Workspace: need 2*N*N if SENSE='V' or 'B')
685 * (Integer Workspace: need N+2 )
686 *
687  IF( ilv .OR. .NOT.wantsn ) THEN
688  IF( ilv ) THEN
689  IF( ilvl ) THEN
690  IF( ilvr ) THEN
691  chtemp = 'B'
692  ELSE
693  chtemp = 'L'
694  END IF
695  ELSE
696  chtemp = 'R'
697  END IF
698 *
699  CALL ctgevc( chtemp, 'B', ldumma, n, a, lda, b, ldb, vl,
700  $ ldvl, vr, ldvr, n, in, work( iwrk ), rwork,
701  $ ierr )
702  IF( ierr.NE.0 ) THEN
703  info = n + 2
704  GO TO 90
705  END IF
706  END IF
707 *
708  IF( .NOT.wantsn ) THEN
709 *
710 * compute eigenvectors (CTGEVC) and estimate condition
711 * numbers (CTGSNA). Note that the definition of the condition
712 * number is not invariant under transformation (u,v) to
713 * (Q*u, Z*v), where (u,v) are eigenvectors of the generalized
714 * Schur form (S,T), Q and Z are orthogonal matrices. In order
715 * to avoid using extra 2*N*N workspace, we have to
716 * re-calculate eigenvectors and estimate the condition numbers
717 * one at a time.
718 *
719  DO 20 i = 1, n
720 *
721  DO 10 j = 1, n
722  bwork( j ) = .false.
723  10 CONTINUE
724  bwork( i ) = .true.
725 *
726  iwrk = n + 1
727  iwrk1 = iwrk + n
728 *
729  IF( wantse .OR. wantsb ) THEN
730  CALL ctgevc( 'B', 'S', bwork, n, a, lda, b, ldb,
731  $ work( 1 ), n, work( iwrk ), n, 1, m,
732  $ work( iwrk1 ), rwork, ierr )
733  IF( ierr.NE.0 ) THEN
734  info = n + 2
735  GO TO 90
736  END IF
737  END IF
738 *
739  CALL ctgsna( sense, 'S', bwork, n, a, lda, b, ldb,
740  $ work( 1 ), n, work( iwrk ), n, rconde( i ),
741  $ rcondv( i ), 1, m, work( iwrk1 ),
742  $ lwork-iwrk1+1, iwork, ierr )
743 *
744  20 CONTINUE
745  END IF
746  END IF
747 *
748 * Undo balancing on VL and VR and normalization
749 * (Workspace: none needed)
750 *
751  IF( ilvl ) THEN
752  CALL cggbak( balanc, 'L', n, ilo, ihi, lscale, rscale, n, vl,
753  $ ldvl, ierr )
754 *
755  DO 50 jc = 1, n
756  temp = zero
757  DO 30 jr = 1, n
758  temp = max( temp, abs1( vl( jr, jc ) ) )
759  30 CONTINUE
760  IF( temp.LT.smlnum )
761  $ GO TO 50
762  temp = one / temp
763  DO 40 jr = 1, n
764  vl( jr, jc ) = vl( jr, jc )*temp
765  40 CONTINUE
766  50 CONTINUE
767  END IF
768 *
769  IF( ilvr ) THEN
770  CALL cggbak( balanc, 'R', n, ilo, ihi, lscale, rscale, n, vr,
771  $ ldvr, ierr )
772  DO 80 jc = 1, n
773  temp = zero
774  DO 60 jr = 1, n
775  temp = max( temp, abs1( vr( jr, jc ) ) )
776  60 CONTINUE
777  IF( temp.LT.smlnum )
778  $ GO TO 80
779  temp = one / temp
780  DO 70 jr = 1, n
781  vr( jr, jc ) = vr( jr, jc )*temp
782  70 CONTINUE
783  80 CONTINUE
784  END IF
785 *
786 * Undo scaling if necessary
787 *
788  90 CONTINUE
789 *
790  IF( ilascl )
791  $ CALL clascl( 'G', 0, 0, anrmto, anrm, n, 1, alpha, n, ierr )
792 *
793  IF( ilbscl )
794  $ CALL clascl( 'G', 0, 0, bnrmto, bnrm, n, 1, beta, n, ierr )
795 *
796  work( 1 ) = maxwrk
797  RETURN
798 *
799 * End of CGGEVX
800 *
subroutine slabad(SMALL, LARGE)
SLABAD
Definition: slabad.f:74
subroutine slascl(TYPE, KL, KU, CFROM, CTO, M, N, A, LDA, INFO)
SLASCL multiplies a general rectangular matrix by a real scalar defined as cto/cfrom.
Definition: slascl.f:143
integer function ilaenv(ISPEC, NAME, OPTS, N1, N2, N3, N4)
ILAENV
Definition: ilaenv.f:162
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:60
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:53
subroutine cggbal(JOB, N, A, LDA, B, LDB, ILO, IHI, LSCALE, RSCALE, WORK, INFO)
CGGBAL
Definition: cggbal.f:177
subroutine cggbak(JOB, SIDE, N, ILO, IHI, LSCALE, RSCALE, M, V, LDV, INFO)
CGGBAK
Definition: cggbak.f:148
real function clange(NORM, M, N, A, LDA, WORK)
CLANGE returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
Definition: clange.f:115
subroutine chgeqz(JOB, COMPQ, COMPZ, N, ILO, IHI, H, LDH, T, LDT, ALPHA, BETA, Q, LDQ, Z, LDZ, WORK, LWORK, RWORK, INFO)
CHGEQZ
Definition: chgeqz.f:284
subroutine cgeqrf(M, N, A, LDA, TAU, WORK, LWORK, INFO)
CGEQRF
Definition: cgeqrf.f:146
subroutine ctgevc(SIDE, HOWMNY, SELECT, N, S, LDS, P, LDP, VL, LDVL, VR, LDVR, MM, M, WORK, RWORK, INFO)
CTGEVC
Definition: ctgevc.f:219
subroutine claset(UPLO, M, N, ALPHA, BETA, A, LDA)
CLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
Definition: claset.f:106
subroutine clascl(TYPE, KL, KU, CFROM, CTO, M, N, A, LDA, INFO)
CLASCL multiplies a general rectangular matrix by a real scalar defined as cto/cfrom.
Definition: clascl.f:143
subroutine clacpy(UPLO, M, N, A, LDA, B, LDB)
CLACPY copies all or part of one two-dimensional array to another.
Definition: clacpy.f:103
subroutine ctgsna(JOB, HOWMNY, SELECT, N, A, LDA, B, LDB, VL, LDVL, VR, LDVR, S, DIF, MM, M, WORK, LWORK, IWORK, INFO)
CTGSNA
Definition: ctgsna.f:311
subroutine cunmqr(SIDE, TRANS, M, N, K, A, LDA, TAU, C, LDC, WORK, LWORK, INFO)
CUNMQR
Definition: cunmqr.f:168
subroutine cgghrd(COMPQ, COMPZ, N, ILO, IHI, A, LDA, B, LDB, Q, LDQ, Z, LDZ, INFO)
CGGHRD
Definition: cgghrd.f:204
subroutine cungqr(M, N, K, A, LDA, TAU, WORK, LWORK, INFO)
CUNGQR
Definition: cungqr.f:128
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:68
Here is the call graph for this function:
Here is the caller graph for this function: