LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ ctgsen()

subroutine ctgsen ( integer  IJOB,
logical  WANTQ,
logical  WANTZ,
logical, dimension( * )  SELECT,
integer  N,
complex, dimension( lda, * )  A,
integer  LDA,
complex, dimension( ldb, * )  B,
integer  LDB,
complex, dimension( * )  ALPHA,
complex, dimension( * )  BETA,
complex, dimension( ldq, * )  Q,
integer  LDQ,
complex, dimension( ldz, * )  Z,
integer  LDZ,
integer  M,
real  PL,
real  PR,
real, dimension( * )  DIF,
complex, dimension( * )  WORK,
integer  LWORK,
integer, dimension( * )  IWORK,
integer  LIWORK,
integer  INFO 
)

CTGSEN

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

Purpose:
 CTGSEN reorders the generalized Schur decomposition of a complex
 matrix pair (A, B) (in terms of an unitary equivalence trans-
 formation Q**H * (A, B) * Z), so that a selected cluster of eigenvalues
 appears in the leading diagonal blocks of the pair (A,B). The leading
 columns of Q and Z form unitary bases of the corresponding left and
 right eigenspaces (deflating subspaces). (A, B) must be in
 generalized Schur canonical form, that is, A and B are both upper
 triangular.

 CTGSEN also computes the generalized eigenvalues

          w(j)= ALPHA(j) / BETA(j)

 of the reordered matrix pair (A, B).

 Optionally, the routine computes estimates of reciprocal condition
 numbers for eigenvalues and eigenspaces. These are Difu[(A11,B11),
 (A22,B22)] and Difl[(A11,B11), (A22,B22)], i.e. the separation(s)
 between the matrix pairs (A11, B11) and (A22,B22) that correspond to
 the selected cluster and the eigenvalues outside the cluster, resp.,
 and norms of "projections" onto left and right eigenspaces w.r.t.
 the selected cluster in the (1,1)-block.
Parameters
[in]IJOB
          IJOB is INTEGER
          Specifies whether condition numbers are required for the
          cluster of eigenvalues (PL and PR) or the deflating subspaces
          (Difu and Difl):
           =0: Only reorder w.r.t. SELECT. No extras.
           =1: Reciprocal of norms of "projections" onto left and right
               eigenspaces w.r.t. the selected cluster (PL and PR).
           =2: Upper bounds on Difu and Difl. F-norm-based estimate
               (DIF(1:2)).
           =3: Estimate of Difu and Difl. 1-norm-based estimate
               (DIF(1:2)).
               About 5 times as expensive as IJOB = 2.
           =4: Compute PL, PR and DIF (i.e. 0, 1 and 2 above): Economic
               version to get it all.
           =5: Compute PL, PR and DIF (i.e. 0, 1 and 3 above)
[in]WANTQ
          WANTQ is LOGICAL
          .TRUE. : update the left transformation matrix Q;
          .FALSE.: do not update Q.
[in]WANTZ
          WANTZ is LOGICAL
          .TRUE. : update the right transformation matrix Z;
          .FALSE.: do not update Z.
[in]SELECT
          SELECT is LOGICAL array, dimension (N)
          SELECT specifies the eigenvalues in the selected cluster. To
          select an eigenvalue w(j), SELECT(j) must be set to
          .TRUE..
[in]N
          N is INTEGER
          The order of the matrices A and B. N >= 0.
[in,out]A
          A is COMPLEX array, dimension(LDA,N)
          On entry, the upper triangular matrix A, in generalized
          Schur canonical form.
          On exit, A is overwritten by the reordered matrix A.
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A. LDA >= max(1,N).
[in,out]B
          B is COMPLEX array, dimension(LDB,N)
          On entry, the upper triangular matrix B, in generalized
          Schur canonical form.
          On exit, B is overwritten by the reordered matrix B.
[in]LDB
          LDB is INTEGER
          The leading dimension of the array B. LDB >= max(1,N).
[out]ALPHA
          ALPHA is COMPLEX array, dimension (N)
[out]BETA
          BETA is COMPLEX array, dimension (N)

          The diagonal elements of A and B, respectively,
          when the pair (A,B) has been reduced to generalized Schur
          form.  ALPHA(i)/BETA(i) i=1,...,N are the generalized
          eigenvalues.
[in,out]Q
          Q is COMPLEX array, dimension (LDQ,N)
          On entry, if WANTQ = .TRUE., Q is an N-by-N matrix.
          On exit, Q has been postmultiplied by the left unitary
          transformation matrix which reorder (A, B); The leading M
          columns of Q form orthonormal bases for the specified pair of
          left eigenspaces (deflating subspaces).
          If WANTQ = .FALSE., Q is not referenced.
[in]LDQ
          LDQ is INTEGER
          The leading dimension of the array Q. LDQ >= 1.
          If WANTQ = .TRUE., LDQ >= N.
[in,out]Z
          Z is COMPLEX array, dimension (LDZ,N)
          On entry, if WANTZ = .TRUE., Z is an N-by-N matrix.
          On exit, Z has been postmultiplied by the left unitary
          transformation matrix which reorder (A, B); The leading M
          columns of Z form orthonormal bases for the specified pair of
          left eigenspaces (deflating subspaces).
          If WANTZ = .FALSE., Z is not referenced.
[in]LDZ
          LDZ is INTEGER
          The leading dimension of the array Z. LDZ >= 1.
          If WANTZ = .TRUE., LDZ >= N.
[out]M
          M is INTEGER
          The dimension of the specified pair of left and right
          eigenspaces, (deflating subspaces) 0 <= M <= N.
[out]PL
          PL is REAL
[out]PR
          PR is REAL

          If IJOB = 1, 4 or 5, PL, PR are lower bounds on the
          reciprocal  of the norm of "projections" onto left and right
          eigenspace with respect to the selected cluster.
          0 < PL, PR <= 1.
          If M = 0 or M = N, PL = PR  = 1.
          If IJOB = 0, 2 or 3 PL, PR are not referenced.
[out]DIF
          DIF is REAL array, dimension (2).
          If IJOB >= 2, DIF(1:2) store the estimates of Difu and Difl.
          If IJOB = 2 or 4, DIF(1:2) are F-norm-based upper bounds on
          Difu and Difl. If IJOB = 3 or 5, DIF(1:2) are 1-norm-based
          estimates of Difu and Difl, computed using reversed
          communication with CLACN2.
          If M = 0 or N, DIF(1:2) = F-norm([A, B]).
          If IJOB = 0 or 1, DIF 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 >=  1
          If IJOB = 1, 2 or 4, LWORK >=  2*M*(N-M)
          If IJOB = 3 or 5, LWORK >=  4*M*(N-M)

          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]IWORK
          IWORK is INTEGER array, dimension (MAX(1,LIWORK))
          On exit, if INFO = 0, IWORK(1) returns the optimal LIWORK.
[in]LIWORK
          LIWORK is INTEGER
          The dimension of the array IWORK. LIWORK >= 1.
          If IJOB = 1, 2 or 4, LIWORK >=  N+2;
          If IJOB = 3 or 5, LIWORK >= MAX(N+2, 2*M*(N-M));

          If LIWORK = -1, then a workspace query is assumed; the
          routine only calculates the optimal size of the IWORK array,
          returns this value as the first entry of the IWORK array, and
          no error message related to LIWORK is issued by XERBLA.
[out]INFO
          INFO is INTEGER
            =0: Successful exit.
            <0: If INFO = -i, the i-th argument had an illegal value.
            =1: Reordering of (A, B) failed because the transformed
                matrix pair (A, B) would be too far from generalized
                Schur form; the problem is very ill-conditioned.
                (A, B) may have been partially reordered.
                If requested, 0 is returned in DIF(*), PL and PR.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Further Details:
  CTGSEN first collects the selected eigenvalues by computing unitary
  U and W that move them to the top left corner of (A, B). In other
  words, the selected eigenvalues are the eigenvalues of (A11, B11) in

              U**H*(A, B)*W = (A11 A12) (B11 B12) n1
                              ( 0  A22),( 0  B22) n2
                                n1  n2    n1  n2

  where N = n1+n2 and U**H means the conjugate transpose of U. The first
  n1 columns of U and W span the specified pair of left and right
  eigenspaces (deflating subspaces) of (A, B).

  If (A, B) has been obtained from the generalized real Schur
  decomposition of a matrix pair (C, D) = Q*(A, B)*Z', then the
  reordered generalized Schur form of (C, D) is given by

           (C, D) = (Q*U)*(U**H *(A, B)*W)*(Z*W)**H,

  and the first n1 columns of Q*U and Z*W span the corresponding
  deflating subspaces of (C, D) (Q and Z store Q*U and Z*W, resp.).

  Note that if the selected eigenvalue is sufficiently ill-conditioned,
  then its value may differ significantly from its value before
  reordering.

  The reciprocal condition numbers of the left and right eigenspaces
  spanned by the first n1 columns of U and W (or Q*U and Z*W) may
  be returned in DIF(1:2), corresponding to Difu and Difl, resp.

  The Difu and Difl are defined as:

       Difu[(A11, B11), (A22, B22)] = sigma-min( Zu )
  and
       Difl[(A11, B11), (A22, B22)] = Difu[(A22, B22), (A11, B11)],

  where sigma-min(Zu) is the smallest singular value of the
  (2*n1*n2)-by-(2*n1*n2) matrix

       Zu = [ kron(In2, A11)  -kron(A22**H, In1) ]
            [ kron(In2, B11)  -kron(B22**H, In1) ].

  Here, Inx is the identity matrix of size nx and A22**H is the
  conjuguate transpose of A22. kron(X, Y) is the Kronecker product between
  the matrices X and Y.

  When DIF(2) is small, small changes in (A, B) can cause large changes
  in the deflating subspace. An approximate (asymptotic) bound on the
  maximum angular error in the computed deflating subspaces is

       EPS * norm((A, B)) / DIF(2),

  where EPS is the machine precision.

  The reciprocal norm of the projectors on the left and right
  eigenspaces associated with (A11, B11) may be returned in PL and PR.
  They are computed as follows. First we compute L and R so that
  P*(A, B)*Q is block diagonal, where

       P = ( I -L ) n1           Q = ( I R ) n1
           ( 0  I ) n2    and        ( 0 I ) n2
             n1 n2                    n1 n2

  and (L, R) is the solution to the generalized Sylvester equation

       A11*R - L*A22 = -A12
       B11*R - L*B22 = -B12

  Then PL = (F-norm(L)**2+1)**(-1/2) and PR = (F-norm(R)**2+1)**(-1/2).
  An approximate (asymptotic) bound on the average absolute error of
  the selected eigenvalues is

       EPS * norm((A, B)) / PL.

  There are also global error bounds which valid for perturbations up
  to a certain restriction:  A lower bound (x) on the smallest
  F-norm(E,F) for which an eigenvalue of (A11, B11) may move and
  coalesce with an eigenvalue of (A22, B22) under perturbation (E,F),
  (i.e. (A + E, B + F), is

   x = min(Difu,Difl)/((1/(PL*PL)+1/(PR*PR))**(1/2)+2*max(1/PL,1/PR)).

  An approximate bound on x can be computed from DIF(1:2), PL and PR.

  If y = ( F-norm(E,F) / x) <= 1, the angles between the perturbed
  (L', R') and unperturbed (L, R) left and right deflating subspaces
  associated with the selected cluster in the (1,1)-blocks can be
  bounded as

   max-angle(L, L') <= arctan( y * PL / (1 - y * (1 - PL * PL)**(1/2))
   max-angle(R, R') <= arctan( y * PR / (1 - y * (1 - PR * PR)**(1/2))

  See LAPACK User's Guide section 4.11 or the following references
  for more information.

  Note that if the default method for computing the Frobenius-norm-
  based estimate DIF is not wanted (see CLATDF), then the parameter
  IDIFJB (see below) should be changed from 3 to 4 (routine CLATDF
  (IJOB = 2 will be used)). See CTGSYL for more details.
Contributors:
Bo Kagstrom and Peter Poromaa, Department of Computing Science, Umea University, S-901 87 Umea, Sweden.
References:
[1] B. Kagstrom; A Direct Method for Reordering Eigenvalues in the Generalized Real Schur Form of a Regular Matrix Pair (A, B), in M.S. Moonen et al (eds), Linear Algebra for Large Scale and Real-Time Applications, Kluwer Academic Publ. 1993, pp 195-218.
[2] B. Kagstrom and P. Poromaa; Computing Eigenspaces with Specified Eigenvalues of a Regular Matrix Pair (A, B) and Condition Estimation: Theory, Algorithms and Software, Report UMINF - 94.04, Department of Computing Science, Umea University, S-901 87 Umea, Sweden, 1994. Also as LAPACK Working Note 87. To appear in Numerical Algorithms, 1996.
[3] B. Kagstrom and P. Poromaa, LAPACK-Style Algorithms and Software for Solving the Generalized Sylvester Equation and Estimating the Separation between Regular Matrix Pairs, Report UMINF - 93.23, Department of Computing Science, Umea University, S-901 87 Umea, Sweden, December 1993, Revised April 1994, Also as LAPACK working Note 75. To appear in ACM Trans. on Math. Software, Vol 22, No 1, 1996.

Definition at line 430 of file ctgsen.f.

433 *
434 * -- LAPACK computational routine --
435 * -- LAPACK is a software package provided by Univ. of Tennessee, --
436 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
437 *
438 * .. Scalar Arguments ..
439  LOGICAL WANTQ, WANTZ
440  INTEGER IJOB, INFO, LDA, LDB, LDQ, LDZ, LIWORK, LWORK,
441  $ M, N
442  REAL PL, PR
443 * ..
444 * .. Array Arguments ..
445  LOGICAL SELECT( * )
446  INTEGER IWORK( * )
447  REAL DIF( * )
448  COMPLEX A( LDA, * ), ALPHA( * ), B( LDB, * ),
449  $ BETA( * ), Q( LDQ, * ), WORK( * ), Z( LDZ, * )
450 * ..
451 *
452 * =====================================================================
453 *
454 * .. Parameters ..
455  INTEGER IDIFJB
456  parameter( idifjb = 3 )
457  REAL ZERO, ONE
458  parameter( zero = 0.0e+0, one = 1.0e+0 )
459 * ..
460 * .. Local Scalars ..
461  LOGICAL LQUERY, SWAP, WANTD, WANTD1, WANTD2, WANTP
462  INTEGER I, IERR, IJB, K, KASE, KS, LIWMIN, LWMIN, MN2,
463  $ N1, N2
464  REAL DSCALE, DSUM, RDSCAL, SAFMIN
465  COMPLEX TEMP1, TEMP2
466 * ..
467 * .. Local Arrays ..
468  INTEGER ISAVE( 3 )
469 * ..
470 * .. External Subroutines ..
471  REAL SLAMCH
472  EXTERNAL clacn2, clacpy, classq, cscal, ctgexc, ctgsyl,
473  $ slamch, xerbla
474 * ..
475 * .. Intrinsic Functions ..
476  INTRINSIC abs, cmplx, conjg, max, sqrt
477 * ..
478 * .. Executable Statements ..
479 *
480 * Decode and test the input parameters
481 *
482  info = 0
483  lquery = ( lwork.EQ.-1 .OR. liwork.EQ.-1 )
484 *
485  IF( ijob.LT.0 .OR. ijob.GT.5 ) THEN
486  info = -1
487  ELSE IF( n.LT.0 ) THEN
488  info = -5
489  ELSE IF( lda.LT.max( 1, n ) ) THEN
490  info = -7
491  ELSE IF( ldb.LT.max( 1, n ) ) THEN
492  info = -9
493  ELSE IF( ldq.LT.1 .OR. ( wantq .AND. ldq.LT.n ) ) THEN
494  info = -13
495  ELSE IF( ldz.LT.1 .OR. ( wantz .AND. ldz.LT.n ) ) THEN
496  info = -15
497  END IF
498 *
499  IF( info.NE.0 ) THEN
500  CALL xerbla( 'CTGSEN', -info )
501  RETURN
502  END IF
503 *
504  ierr = 0
505 *
506  wantp = ijob.EQ.1 .OR. ijob.GE.4
507  wantd1 = ijob.EQ.2 .OR. ijob.EQ.4
508  wantd2 = ijob.EQ.3 .OR. ijob.EQ.5
509  wantd = wantd1 .OR. wantd2
510 *
511 * Set M to the dimension of the specified pair of deflating
512 * subspaces.
513 *
514  m = 0
515  IF( .NOT.lquery .OR. ijob.NE.0 ) THEN
516  DO 10 k = 1, n
517  alpha( k ) = a( k, k )
518  beta( k ) = b( k, k )
519  IF( k.LT.n ) THEN
520  IF( SELECT( k ) )
521  $ m = m + 1
522  ELSE
523  IF( SELECT( n ) )
524  $ m = m + 1
525  END IF
526  10 CONTINUE
527  END IF
528 *
529  IF( ijob.EQ.1 .OR. ijob.EQ.2 .OR. ijob.EQ.4 ) THEN
530  lwmin = max( 1, 2*m*(n-m) )
531  liwmin = max( 1, n+2 )
532  ELSE IF( ijob.EQ.3 .OR. ijob.EQ.5 ) THEN
533  lwmin = max( 1, 4*m*(n-m) )
534  liwmin = max( 1, 2*m*(n-m), n+2 )
535  ELSE
536  lwmin = 1
537  liwmin = 1
538  END IF
539 *
540  work( 1 ) = lwmin
541  iwork( 1 ) = liwmin
542 *
543  IF( lwork.LT.lwmin .AND. .NOT.lquery ) THEN
544  info = -21
545  ELSE IF( liwork.LT.liwmin .AND. .NOT.lquery ) THEN
546  info = -23
547  END IF
548 *
549  IF( info.NE.0 ) THEN
550  CALL xerbla( 'CTGSEN', -info )
551  RETURN
552  ELSE IF( lquery ) THEN
553  RETURN
554  END IF
555 *
556 * Quick return if possible.
557 *
558  IF( m.EQ.n .OR. m.EQ.0 ) THEN
559  IF( wantp ) THEN
560  pl = one
561  pr = one
562  END IF
563  IF( wantd ) THEN
564  dscale = zero
565  dsum = one
566  DO 20 i = 1, n
567  CALL classq( n, a( 1, i ), 1, dscale, dsum )
568  CALL classq( n, b( 1, i ), 1, dscale, dsum )
569  20 CONTINUE
570  dif( 1 ) = dscale*sqrt( dsum )
571  dif( 2 ) = dif( 1 )
572  END IF
573  GO TO 70
574  END IF
575 *
576 * Get machine constant
577 *
578  safmin = slamch( 'S' )
579 *
580 * Collect the selected blocks at the top-left corner of (A, B).
581 *
582  ks = 0
583  DO 30 k = 1, n
584  swap = SELECT( k )
585  IF( swap ) THEN
586  ks = ks + 1
587 *
588 * Swap the K-th block to position KS. Compute unitary Q
589 * and Z that will swap adjacent diagonal blocks in (A, B).
590 *
591  IF( k.NE.ks )
592  $ CALL ctgexc( wantq, wantz, n, a, lda, b, ldb, q, ldq, z,
593  $ ldz, k, ks, ierr )
594 *
595  IF( ierr.GT.0 ) THEN
596 *
597 * Swap is rejected: exit.
598 *
599  info = 1
600  IF( wantp ) THEN
601  pl = zero
602  pr = zero
603  END IF
604  IF( wantd ) THEN
605  dif( 1 ) = zero
606  dif( 2 ) = zero
607  END IF
608  GO TO 70
609  END IF
610  END IF
611  30 CONTINUE
612  IF( wantp ) THEN
613 *
614 * Solve generalized Sylvester equation for R and L:
615 * A11 * R - L * A22 = A12
616 * B11 * R - L * B22 = B12
617 *
618  n1 = m
619  n2 = n - m
620  i = n1 + 1
621  CALL clacpy( 'Full', n1, n2, a( 1, i ), lda, work, n1 )
622  CALL clacpy( 'Full', n1, n2, b( 1, i ), ldb, work( n1*n2+1 ),
623  $ n1 )
624  ijb = 0
625  CALL ctgsyl( 'N', ijb, n1, n2, a, lda, a( i, i ), lda, work,
626  $ n1, b, ldb, b( i, i ), ldb, work( n1*n2+1 ), n1,
627  $ dscale, dif( 1 ), work( n1*n2*2+1 ),
628  $ lwork-2*n1*n2, iwork, ierr )
629 *
630 * Estimate the reciprocal of norms of "projections" onto
631 * left and right eigenspaces
632 *
633  rdscal = zero
634  dsum = one
635  CALL classq( n1*n2, work, 1, rdscal, dsum )
636  pl = rdscal*sqrt( dsum )
637  IF( pl.EQ.zero ) THEN
638  pl = one
639  ELSE
640  pl = dscale / ( sqrt( dscale*dscale / pl+pl )*sqrt( pl ) )
641  END IF
642  rdscal = zero
643  dsum = one
644  CALL classq( n1*n2, work( n1*n2+1 ), 1, rdscal, dsum )
645  pr = rdscal*sqrt( dsum )
646  IF( pr.EQ.zero ) THEN
647  pr = one
648  ELSE
649  pr = dscale / ( sqrt( dscale*dscale / pr+pr )*sqrt( pr ) )
650  END IF
651  END IF
652  IF( wantd ) THEN
653 *
654 * Compute estimates Difu and Difl.
655 *
656  IF( wantd1 ) THEN
657  n1 = m
658  n2 = n - m
659  i = n1 + 1
660  ijb = idifjb
661 *
662 * Frobenius norm-based Difu estimate.
663 *
664  CALL ctgsyl( 'N', ijb, n1, n2, a, lda, a( i, i ), lda, work,
665  $ n1, b, ldb, b( i, i ), ldb, work( n1*n2+1 ),
666  $ n1, dscale, dif( 1 ), work( n1*n2*2+1 ),
667  $ lwork-2*n1*n2, iwork, ierr )
668 *
669 * Frobenius norm-based Difl estimate.
670 *
671  CALL ctgsyl( 'N', ijb, n2, n1, a( i, i ), lda, a, lda, work,
672  $ n2, b( i, i ), ldb, b, ldb, work( n1*n2+1 ),
673  $ n2, dscale, dif( 2 ), work( n1*n2*2+1 ),
674  $ lwork-2*n1*n2, iwork, ierr )
675  ELSE
676 *
677 * Compute 1-norm-based estimates of Difu and Difl using
678 * reversed communication with CLACN2. In each step a
679 * generalized Sylvester equation or a transposed variant
680 * is solved.
681 *
682  kase = 0
683  n1 = m
684  n2 = n - m
685  i = n1 + 1
686  ijb = 0
687  mn2 = 2*n1*n2
688 *
689 * 1-norm-based estimate of Difu.
690 *
691  40 CONTINUE
692  CALL clacn2( mn2, work( mn2+1 ), work, dif( 1 ), kase,
693  $ isave )
694  IF( kase.NE.0 ) THEN
695  IF( kase.EQ.1 ) THEN
696 *
697 * Solve generalized Sylvester equation
698 *
699  CALL ctgsyl( 'N', ijb, n1, n2, a, lda, a( i, i ), lda,
700  $ work, n1, b, ldb, b( i, i ), ldb,
701  $ work( n1*n2+1 ), n1, dscale, dif( 1 ),
702  $ work( n1*n2*2+1 ), lwork-2*n1*n2, iwork,
703  $ ierr )
704  ELSE
705 *
706 * Solve the transposed variant.
707 *
708  CALL ctgsyl( 'C', ijb, n1, n2, a, lda, a( i, i ), lda,
709  $ work, n1, b, ldb, b( i, i ), ldb,
710  $ work( n1*n2+1 ), n1, dscale, dif( 1 ),
711  $ work( n1*n2*2+1 ), lwork-2*n1*n2, iwork,
712  $ ierr )
713  END IF
714  GO TO 40
715  END IF
716  dif( 1 ) = dscale / dif( 1 )
717 *
718 * 1-norm-based estimate of Difl.
719 *
720  50 CONTINUE
721  CALL clacn2( mn2, work( mn2+1 ), work, dif( 2 ), kase,
722  $ isave )
723  IF( kase.NE.0 ) THEN
724  IF( kase.EQ.1 ) THEN
725 *
726 * Solve generalized Sylvester equation
727 *
728  CALL ctgsyl( 'N', ijb, n2, n1, a( i, i ), lda, a, lda,
729  $ work, n2, b( i, i ), ldb, b, ldb,
730  $ work( n1*n2+1 ), n2, dscale, dif( 2 ),
731  $ work( n1*n2*2+1 ), lwork-2*n1*n2, iwork,
732  $ ierr )
733  ELSE
734 *
735 * Solve the transposed variant.
736 *
737  CALL ctgsyl( 'C', ijb, n2, n1, a( i, i ), lda, a, lda,
738  $ work, n2, b, ldb, b( i, i ), ldb,
739  $ work( n1*n2+1 ), n2, dscale, dif( 2 ),
740  $ work( n1*n2*2+1 ), lwork-2*n1*n2, iwork,
741  $ ierr )
742  END IF
743  GO TO 50
744  END IF
745  dif( 2 ) = dscale / dif( 2 )
746  END IF
747  END IF
748 *
749 * If B(K,K) is complex, make it real and positive (normalization
750 * of the generalized Schur form) and Store the generalized
751 * eigenvalues of reordered pair (A, B)
752 *
753  DO 60 k = 1, n
754  dscale = abs( b( k, k ) )
755  IF( dscale.GT.safmin ) THEN
756  temp1 = conjg( b( k, k ) / dscale )
757  temp2 = b( k, k ) / dscale
758  b( k, k ) = dscale
759  CALL cscal( n-k, temp1, b( k, k+1 ), ldb )
760  CALL cscal( n-k+1, temp1, a( k, k ), lda )
761  IF( wantq )
762  $ CALL cscal( n, temp2, q( 1, k ), 1 )
763  ELSE
764  b( k, k ) = cmplx( zero, zero )
765  END IF
766 *
767  alpha( k ) = a( k, k )
768  beta( k ) = b( k, k )
769 *
770  60 CONTINUE
771 *
772  70 CONTINUE
773 *
774  work( 1 ) = lwmin
775  iwork( 1 ) = liwmin
776 *
777  RETURN
778 *
779 * End of CTGSEN
780 *
subroutine classq(n, x, incx, scl, sumsq)
CLASSQ updates a sum of squares represented in scaled form.
Definition: classq.f90:126
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:60
subroutine cscal(N, CA, CX, INCX)
CSCAL
Definition: cscal.f:78
subroutine ctgexc(WANTQ, WANTZ, N, A, LDA, B, LDB, Q, LDQ, Z, LDZ, IFST, ILST, INFO)
CTGEXC
Definition: ctgexc.f:200
subroutine clacn2(N, V, X, EST, KASE, ISAVE)
CLACN2 estimates the 1-norm of a square matrix, using reverse communication for evaluating matrix-vec...
Definition: clacn2.f:133
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 ctgsyl(TRANS, IJOB, M, N, A, LDA, B, LDB, C, LDC, D, LDD, E, LDE, F, LDF, SCALE, DIF, WORK, LWORK, IWORK, INFO)
CTGSYL
Definition: ctgsyl.f:295
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: