zggev.c
Go to the documentation of this file.
00001 /* zggev.f -- translated by f2c (version 20061008).
00002    You must link the resulting object file with libf2c:
00003         on Microsoft Windows system, link with libf2c.lib;
00004         on Linux or Unix systems, link with .../path/to/libf2c.a -lm
00005         or, if you install libf2c.a in a standard place, with -lf2c -lm
00006         -- in that order, at the end of the command line, as in
00007                 cc *.o -lf2c -lm
00008         Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
00009 
00010                 http://www.netlib.org/f2c/libf2c.zip
00011 */
00012 
00013 #include "f2c.h"
00014 #include "blaswrap.h"
00015 
00016 /* Table of constant values */
00017 
00018 static doublecomplex c_b1 = {0.,0.};
00019 static doublecomplex c_b2 = {1.,0.};
00020 static integer c__1 = 1;
00021 static integer c__0 = 0;
00022 static integer c_n1 = -1;
00023 
00024 /* Subroutine */ int zggev_(char *jobvl, char *jobvr, integer *n, 
00025         doublecomplex *a, integer *lda, doublecomplex *b, integer *ldb, 
00026         doublecomplex *alpha, doublecomplex *beta, doublecomplex *vl, integer 
00027         *ldvl, doublecomplex *vr, integer *ldvr, doublecomplex *work, integer 
00028         *lwork, doublereal *rwork, integer *info)
00029 {
00030     /* System generated locals */
00031     integer a_dim1, a_offset, b_dim1, b_offset, vl_dim1, vl_offset, vr_dim1, 
00032             vr_offset, i__1, i__2, i__3, i__4;
00033     doublereal d__1, d__2, d__3, d__4;
00034     doublecomplex z__1;
00035 
00036     /* Builtin functions */
00037     double sqrt(doublereal), d_imag(doublecomplex *);
00038 
00039     /* Local variables */
00040     integer jc, in, jr, ihi, ilo;
00041     doublereal eps;
00042     logical ilv;
00043     doublereal anrm, bnrm;
00044     integer ierr, itau;
00045     doublereal temp;
00046     logical ilvl, ilvr;
00047     integer iwrk;
00048     extern logical lsame_(char *, char *);
00049     integer ileft, icols, irwrk, irows;
00050     extern /* Subroutine */ int dlabad_(doublereal *, doublereal *);
00051     extern doublereal dlamch_(char *);
00052     extern /* Subroutine */ int zggbak_(char *, char *, integer *, integer *, 
00053             integer *, doublereal *, doublereal *, integer *, doublecomplex *, 
00054              integer *, integer *), zggbal_(char *, integer *, 
00055              doublecomplex *, integer *, doublecomplex *, integer *, integer *
00056 , integer *, doublereal *, doublereal *, doublereal *, integer *);
00057     logical ilascl, ilbscl;
00058     extern /* Subroutine */ int xerbla_(char *, integer *);
00059     extern integer ilaenv_(integer *, char *, char *, integer *, integer *, 
00060             integer *, integer *);
00061     logical ldumma[1];
00062     char chtemp[1];
00063     doublereal bignum;
00064     extern doublereal zlange_(char *, integer *, integer *, doublecomplex *, 
00065             integer *, doublereal *);
00066     integer ijobvl, iright;
00067     extern /* Subroutine */ int zgghrd_(char *, char *, integer *, integer *, 
00068             integer *, doublecomplex *, integer *, doublecomplex *, integer *, 
00069              doublecomplex *, integer *, doublecomplex *, integer *, integer *
00070 ), zlascl_(char *, integer *, integer *, 
00071             doublereal *, doublereal *, integer *, integer *, doublecomplex *, 
00072              integer *, integer *);
00073     integer ijobvr;
00074     extern /* Subroutine */ int zgeqrf_(integer *, integer *, doublecomplex *, 
00075              integer *, doublecomplex *, doublecomplex *, integer *, integer *
00076 );
00077     doublereal anrmto;
00078     integer lwkmin;
00079     doublereal bnrmto;
00080     extern /* Subroutine */ int zlacpy_(char *, integer *, integer *, 
00081             doublecomplex *, integer *, doublecomplex *, integer *), 
00082             zlaset_(char *, integer *, integer *, doublecomplex *, 
00083             doublecomplex *, doublecomplex *, integer *), ztgevc_(
00084             char *, char *, logical *, integer *, doublecomplex *, integer *, 
00085             doublecomplex *, integer *, doublecomplex *, integer *, 
00086             doublecomplex *, integer *, integer *, integer *, doublecomplex *, 
00087              doublereal *, integer *), zhgeqz_(char *, char *, 
00088              char *, integer *, integer *, integer *, doublecomplex *, 
00089             integer *, doublecomplex *, integer *, doublecomplex *, 
00090             doublecomplex *, doublecomplex *, integer *, doublecomplex *, 
00091             integer *, doublecomplex *, integer *, doublereal *, integer *);
00092     doublereal smlnum;
00093     integer lwkopt;
00094     logical lquery;
00095     extern /* Subroutine */ int zungqr_(integer *, integer *, integer *, 
00096             doublecomplex *, integer *, doublecomplex *, doublecomplex *, 
00097             integer *, integer *), zunmqr_(char *, char *, integer *, integer 
00098             *, integer *, doublecomplex *, integer *, doublecomplex *, 
00099             doublecomplex *, integer *, doublecomplex *, integer *, integer *);
00100 
00101 
00102 /*  -- LAPACK driver routine (version 3.2) -- */
00103 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00104 /*     November 2006 */
00105 
00106 /*     .. Scalar Arguments .. */
00107 /*     .. */
00108 /*     .. Array Arguments .. */
00109 /*     .. */
00110 
00111 /*  Purpose */
00112 /*  ======= */
00113 
00114 /*  ZGGEV computes for a pair of N-by-N complex nonsymmetric matrices */
00115 /*  (A,B), the generalized eigenvalues, and optionally, the left and/or */
00116 /*  right generalized eigenvectors. */
00117 
00118 /*  A generalized eigenvalue for a pair of matrices (A,B) is a scalar */
00119 /*  lambda or a ratio alpha/beta = lambda, such that A - lambda*B is */
00120 /*  singular. It is usually represented as the pair (alpha,beta), as */
00121 /*  there is a reasonable interpretation for beta=0, and even for both */
00122 /*  being zero. */
00123 
00124 /*  The right generalized eigenvector v(j) corresponding to the */
00125 /*  generalized eigenvalue lambda(j) of (A,B) satisfies */
00126 
00127 /*               A * v(j) = lambda(j) * B * v(j). */
00128 
00129 /*  The left generalized eigenvector u(j) corresponding to the */
00130 /*  generalized eigenvalues lambda(j) of (A,B) satisfies */
00131 
00132 /*               u(j)**H * A = lambda(j) * u(j)**H * B */
00133 
00134 /*  where u(j)**H is the conjugate-transpose of u(j). */
00135 
00136 /*  Arguments */
00137 /*  ========= */
00138 
00139 /*  JOBVL   (input) CHARACTER*1 */
00140 /*          = 'N':  do not compute the left generalized eigenvectors; */
00141 /*          = 'V':  compute the left generalized eigenvectors. */
00142 
00143 /*  JOBVR   (input) CHARACTER*1 */
00144 /*          = 'N':  do not compute the right generalized eigenvectors; */
00145 /*          = 'V':  compute the right generalized eigenvectors. */
00146 
00147 /*  N       (input) INTEGER */
00148 /*          The order of the matrices A, B, VL, and VR.  N >= 0. */
00149 
00150 /*  A       (input/output) COMPLEX*16 array, dimension (LDA, N) */
00151 /*          On entry, the matrix A in the pair (A,B). */
00152 /*          On exit, A has been overwritten. */
00153 
00154 /*  LDA     (input) INTEGER */
00155 /*          The leading dimension of A.  LDA >= max(1,N). */
00156 
00157 /*  B       (input/output) COMPLEX*16 array, dimension (LDB, N) */
00158 /*          On entry, the matrix B in the pair (A,B). */
00159 /*          On exit, B has been overwritten. */
00160 
00161 /*  LDB     (input) INTEGER */
00162 /*          The leading dimension of B.  LDB >= max(1,N). */
00163 
00164 /*  ALPHA   (output) COMPLEX*16 array, dimension (N) */
00165 /*  BETA    (output) COMPLEX*16 array, dimension (N) */
00166 /*          On exit, ALPHA(j)/BETA(j), j=1,...,N, will be the */
00167 /*          generalized eigenvalues. */
00168 
00169 /*          Note: the quotients ALPHA(j)/BETA(j) may easily over- or */
00170 /*          underflow, and BETA(j) may even be zero.  Thus, the user */
00171 /*          should avoid naively computing the ratio alpha/beta. */
00172 /*          However, ALPHA will be always less than and usually */
00173 /*          comparable with norm(A) in magnitude, and BETA always less */
00174 /*          than and usually comparable with norm(B). */
00175 
00176 /*  VL      (output) COMPLEX*16 array, dimension (LDVL,N) */
00177 /*          If JOBVL = 'V', the left generalized eigenvectors u(j) are */
00178 /*          stored one after another in the columns of VL, in the same */
00179 /*          order as their eigenvalues. */
00180 /*          Each eigenvector is scaled so the largest component has */
00181 /*          abs(real part) + abs(imag. part) = 1. */
00182 /*          Not referenced if JOBVL = 'N'. */
00183 
00184 /*  LDVL    (input) INTEGER */
00185 /*          The leading dimension of the matrix VL. LDVL >= 1, and */
00186 /*          if JOBVL = 'V', LDVL >= N. */
00187 
00188 /*  VR      (output) COMPLEX*16 array, dimension (LDVR,N) */
00189 /*          If JOBVR = 'V', the right generalized eigenvectors v(j) are */
00190 /*          stored one after another in the columns of VR, in the same */
00191 /*          order as their eigenvalues. */
00192 /*          Each eigenvector is scaled so the largest component has */
00193 /*          abs(real part) + abs(imag. part) = 1. */
00194 /*          Not referenced if JOBVR = 'N'. */
00195 
00196 /*  LDVR    (input) INTEGER */
00197 /*          The leading dimension of the matrix VR. LDVR >= 1, and */
00198 /*          if JOBVR = 'V', LDVR >= N. */
00199 
00200 /*  WORK    (workspace/output) COMPLEX*16 array, dimension (MAX(1,LWORK)) */
00201 /*          On exit, if INFO = 0, WORK(1) returns the optimal LWORK. */
00202 
00203 /*  LWORK   (input) INTEGER */
00204 /*          The dimension of the array WORK.  LWORK >= max(1,2*N). */
00205 /*          For good performance, LWORK must generally be larger. */
00206 
00207 /*          If LWORK = -1, then a workspace query is assumed; the routine */
00208 /*          only calculates the optimal size of the WORK array, returns */
00209 /*          this value as the first entry of the WORK array, and no error */
00210 /*          message related to LWORK is issued by XERBLA. */
00211 
00212 /*  RWORK   (workspace/output) DOUBLE PRECISION array, dimension (8*N) */
00213 
00214 /*  INFO    (output) INTEGER */
00215 /*          = 0:  successful exit */
00216 /*          < 0:  if INFO = -i, the i-th argument had an illegal value. */
00217 /*          =1,...,N: */
00218 /*                The QZ iteration failed.  No eigenvectors have been */
00219 /*                calculated, but ALPHA(j) and BETA(j) should be */
00220 /*                correct for j=INFO+1,...,N. */
00221 /*          > N:  =N+1: other then QZ iteration failed in DHGEQZ, */
00222 /*                =N+2: error return from DTGEVC. */
00223 
00224 /*  ===================================================================== */
00225 
00226 /*     .. Parameters .. */
00227 /*     .. */
00228 /*     .. Local Scalars .. */
00229 /*     .. */
00230 /*     .. Local Arrays .. */
00231 /*     .. */
00232 /*     .. External Subroutines .. */
00233 /*     .. */
00234 /*     .. External Functions .. */
00235 /*     .. */
00236 /*     .. Intrinsic Functions .. */
00237 /*     .. */
00238 /*     .. Statement Functions .. */
00239 /*     .. */
00240 /*     .. Statement Function definitions .. */
00241 /*     .. */
00242 /*     .. Executable Statements .. */
00243 
00244 /*     Decode the input arguments */
00245 
00246     /* Parameter adjustments */
00247     a_dim1 = *lda;
00248     a_offset = 1 + a_dim1;
00249     a -= a_offset;
00250     b_dim1 = *ldb;
00251     b_offset = 1 + b_dim1;
00252     b -= b_offset;
00253     --alpha;
00254     --beta;
00255     vl_dim1 = *ldvl;
00256     vl_offset = 1 + vl_dim1;
00257     vl -= vl_offset;
00258     vr_dim1 = *ldvr;
00259     vr_offset = 1 + vr_dim1;
00260     vr -= vr_offset;
00261     --work;
00262     --rwork;
00263 
00264     /* Function Body */
00265     if (lsame_(jobvl, "N")) {
00266         ijobvl = 1;
00267         ilvl = FALSE_;
00268     } else if (lsame_(jobvl, "V")) {
00269         ijobvl = 2;
00270         ilvl = TRUE_;
00271     } else {
00272         ijobvl = -1;
00273         ilvl = FALSE_;
00274     }
00275 
00276     if (lsame_(jobvr, "N")) {
00277         ijobvr = 1;
00278         ilvr = FALSE_;
00279     } else if (lsame_(jobvr, "V")) {
00280         ijobvr = 2;
00281         ilvr = TRUE_;
00282     } else {
00283         ijobvr = -1;
00284         ilvr = FALSE_;
00285     }
00286     ilv = ilvl || ilvr;
00287 
00288 /*     Test the input arguments */
00289 
00290     *info = 0;
00291     lquery = *lwork == -1;
00292     if (ijobvl <= 0) {
00293         *info = -1;
00294     } else if (ijobvr <= 0) {
00295         *info = -2;
00296     } else if (*n < 0) {
00297         *info = -3;
00298     } else if (*lda < max(1,*n)) {
00299         *info = -5;
00300     } else if (*ldb < max(1,*n)) {
00301         *info = -7;
00302     } else if (*ldvl < 1 || ilvl && *ldvl < *n) {
00303         *info = -11;
00304     } else if (*ldvr < 1 || ilvr && *ldvr < *n) {
00305         *info = -13;
00306     }
00307 
00308 /*     Compute workspace */
00309 /*      (Note: Comments in the code beginning "Workspace:" describe the */
00310 /*       minimal amount of workspace needed at that point in the code, */
00311 /*       as well as the preferred amount for good performance. */
00312 /*       NB refers to the optimal block size for the immediately */
00313 /*       following subroutine, as returned by ILAENV. The workspace is */
00314 /*       computed assuming ILO = 1 and IHI = N, the worst case.) */
00315 
00316     if (*info == 0) {
00317 /* Computing MAX */
00318         i__1 = 1, i__2 = *n << 1;
00319         lwkmin = max(i__1,i__2);
00320 /* Computing MAX */
00321         i__1 = 1, i__2 = *n + *n * ilaenv_(&c__1, "ZGEQRF", " ", n, &c__1, n, 
00322                 &c__0);
00323         lwkopt = max(i__1,i__2);
00324 /* Computing MAX */
00325         i__1 = lwkopt, i__2 = *n + *n * ilaenv_(&c__1, "ZUNMQR", " ", n, &
00326                 c__1, n, &c__0);
00327         lwkopt = max(i__1,i__2);
00328         if (ilvl) {
00329 /* Computing MAX */
00330             i__1 = lwkopt, i__2 = *n + *n * ilaenv_(&c__1, "ZUNGQR", " ", n, &
00331                     c__1, n, &c_n1);
00332             lwkopt = max(i__1,i__2);
00333         }
00334         work[1].r = (doublereal) lwkopt, work[1].i = 0.;
00335 
00336         if (*lwork < lwkmin && ! lquery) {
00337             *info = -15;
00338         }
00339     }
00340 
00341     if (*info != 0) {
00342         i__1 = -(*info);
00343         xerbla_("ZGGEV ", &i__1);
00344         return 0;
00345     } else if (lquery) {
00346         return 0;
00347     }
00348 
00349 /*     Quick return if possible */
00350 
00351     if (*n == 0) {
00352         return 0;
00353     }
00354 
00355 /*     Get machine constants */
00356 
00357     eps = dlamch_("E") * dlamch_("B");
00358     smlnum = dlamch_("S");
00359     bignum = 1. / smlnum;
00360     dlabad_(&smlnum, &bignum);
00361     smlnum = sqrt(smlnum) / eps;
00362     bignum = 1. / smlnum;
00363 
00364 /*     Scale A if max element outside range [SMLNUM,BIGNUM] */
00365 
00366     anrm = zlange_("M", n, n, &a[a_offset], lda, &rwork[1]);
00367     ilascl = FALSE_;
00368     if (anrm > 0. && anrm < smlnum) {
00369         anrmto = smlnum;
00370         ilascl = TRUE_;
00371     } else if (anrm > bignum) {
00372         anrmto = bignum;
00373         ilascl = TRUE_;
00374     }
00375     if (ilascl) {
00376         zlascl_("G", &c__0, &c__0, &anrm, &anrmto, n, n, &a[a_offset], lda, &
00377                 ierr);
00378     }
00379 
00380 /*     Scale B if max element outside range [SMLNUM,BIGNUM] */
00381 
00382     bnrm = zlange_("M", n, n, &b[b_offset], ldb, &rwork[1]);
00383     ilbscl = FALSE_;
00384     if (bnrm > 0. && bnrm < smlnum) {
00385         bnrmto = smlnum;
00386         ilbscl = TRUE_;
00387     } else if (bnrm > bignum) {
00388         bnrmto = bignum;
00389         ilbscl = TRUE_;
00390     }
00391     if (ilbscl) {
00392         zlascl_("G", &c__0, &c__0, &bnrm, &bnrmto, n, n, &b[b_offset], ldb, &
00393                 ierr);
00394     }
00395 
00396 /*     Permute the matrices A, B to isolate eigenvalues if possible */
00397 /*     (Real Workspace: need 6*N) */
00398 
00399     ileft = 1;
00400     iright = *n + 1;
00401     irwrk = iright + *n;
00402     zggbal_("P", n, &a[a_offset], lda, &b[b_offset], ldb, &ilo, &ihi, &rwork[
00403             ileft], &rwork[iright], &rwork[irwrk], &ierr);
00404 
00405 /*     Reduce B to triangular form (QR decomposition of B) */
00406 /*     (Complex Workspace: need N, prefer N*NB) */
00407 
00408     irows = ihi + 1 - ilo;
00409     if (ilv) {
00410         icols = *n + 1 - ilo;
00411     } else {
00412         icols = irows;
00413     }
00414     itau = 1;
00415     iwrk = itau + irows;
00416     i__1 = *lwork + 1 - iwrk;
00417     zgeqrf_(&irows, &icols, &b[ilo + ilo * b_dim1], ldb, &work[itau], &work[
00418             iwrk], &i__1, &ierr);
00419 
00420 /*     Apply the orthogonal transformation to matrix A */
00421 /*     (Complex Workspace: need N, prefer N*NB) */
00422 
00423     i__1 = *lwork + 1 - iwrk;
00424     zunmqr_("L", "C", &irows, &icols, &irows, &b[ilo + ilo * b_dim1], ldb, &
00425             work[itau], &a[ilo + ilo * a_dim1], lda, &work[iwrk], &i__1, &
00426             ierr);
00427 
00428 /*     Initialize VL */
00429 /*     (Complex Workspace: need N, prefer N*NB) */
00430 
00431     if (ilvl) {
00432         zlaset_("Full", n, n, &c_b1, &c_b2, &vl[vl_offset], ldvl);
00433         if (irows > 1) {
00434             i__1 = irows - 1;
00435             i__2 = irows - 1;
00436             zlacpy_("L", &i__1, &i__2, &b[ilo + 1 + ilo * b_dim1], ldb, &vl[
00437                     ilo + 1 + ilo * vl_dim1], ldvl);
00438         }
00439         i__1 = *lwork + 1 - iwrk;
00440         zungqr_(&irows, &irows, &irows, &vl[ilo + ilo * vl_dim1], ldvl, &work[
00441                 itau], &work[iwrk], &i__1, &ierr);
00442     }
00443 
00444 /*     Initialize VR */
00445 
00446     if (ilvr) {
00447         zlaset_("Full", n, n, &c_b1, &c_b2, &vr[vr_offset], ldvr);
00448     }
00449 
00450 /*     Reduce to generalized Hessenberg form */
00451 
00452     if (ilv) {
00453 
00454 /*        Eigenvectors requested -- work on whole matrix. */
00455 
00456         zgghrd_(jobvl, jobvr, n, &ilo, &ihi, &a[a_offset], lda, &b[b_offset], 
00457                 ldb, &vl[vl_offset], ldvl, &vr[vr_offset], ldvr, &ierr);
00458     } else {
00459         zgghrd_("N", "N", &irows, &c__1, &irows, &a[ilo + ilo * a_dim1], lda, 
00460                 &b[ilo + ilo * b_dim1], ldb, &vl[vl_offset], ldvl, &vr[
00461                 vr_offset], ldvr, &ierr);
00462     }
00463 
00464 /*     Perform QZ algorithm (Compute eigenvalues, and optionally, the */
00465 /*     Schur form and Schur vectors) */
00466 /*     (Complex Workspace: need N) */
00467 /*     (Real Workspace: need N) */
00468 
00469     iwrk = itau;
00470     if (ilv) {
00471         *(unsigned char *)chtemp = 'S';
00472     } else {
00473         *(unsigned char *)chtemp = 'E';
00474     }
00475     i__1 = *lwork + 1 - iwrk;
00476     zhgeqz_(chtemp, jobvl, jobvr, n, &ilo, &ihi, &a[a_offset], lda, &b[
00477             b_offset], ldb, &alpha[1], &beta[1], &vl[vl_offset], ldvl, &vr[
00478             vr_offset], ldvr, &work[iwrk], &i__1, &rwork[irwrk], &ierr);
00479     if (ierr != 0) {
00480         if (ierr > 0 && ierr <= *n) {
00481             *info = ierr;
00482         } else if (ierr > *n && ierr <= *n << 1) {
00483             *info = ierr - *n;
00484         } else {
00485             *info = *n + 1;
00486         }
00487         goto L70;
00488     }
00489 
00490 /*     Compute Eigenvectors */
00491 /*     (Real Workspace: need 2*N) */
00492 /*     (Complex Workspace: need 2*N) */
00493 
00494     if (ilv) {
00495         if (ilvl) {
00496             if (ilvr) {
00497                 *(unsigned char *)chtemp = 'B';
00498             } else {
00499                 *(unsigned char *)chtemp = 'L';
00500             }
00501         } else {
00502             *(unsigned char *)chtemp = 'R';
00503         }
00504 
00505         ztgevc_(chtemp, "B", ldumma, n, &a[a_offset], lda, &b[b_offset], ldb, 
00506                 &vl[vl_offset], ldvl, &vr[vr_offset], ldvr, n, &in, &work[
00507                 iwrk], &rwork[irwrk], &ierr);
00508         if (ierr != 0) {
00509             *info = *n + 2;
00510             goto L70;
00511         }
00512 
00513 /*        Undo balancing on VL and VR and normalization */
00514 /*        (Workspace: none needed) */
00515 
00516         if (ilvl) {
00517             zggbak_("P", "L", n, &ilo, &ihi, &rwork[ileft], &rwork[iright], n, 
00518                      &vl[vl_offset], ldvl, &ierr);
00519             i__1 = *n;
00520             for (jc = 1; jc <= i__1; ++jc) {
00521                 temp = 0.;
00522                 i__2 = *n;
00523                 for (jr = 1; jr <= i__2; ++jr) {
00524 /* Computing MAX */
00525                     i__3 = jr + jc * vl_dim1;
00526                     d__3 = temp, d__4 = (d__1 = vl[i__3].r, abs(d__1)) + (
00527                             d__2 = d_imag(&vl[jr + jc * vl_dim1]), abs(d__2));
00528                     temp = max(d__3,d__4);
00529 /* L10: */
00530                 }
00531                 if (temp < smlnum) {
00532                     goto L30;
00533                 }
00534                 temp = 1. / temp;
00535                 i__2 = *n;
00536                 for (jr = 1; jr <= i__2; ++jr) {
00537                     i__3 = jr + jc * vl_dim1;
00538                     i__4 = jr + jc * vl_dim1;
00539                     z__1.r = temp * vl[i__4].r, z__1.i = temp * vl[i__4].i;
00540                     vl[i__3].r = z__1.r, vl[i__3].i = z__1.i;
00541 /* L20: */
00542                 }
00543 L30:
00544                 ;
00545             }
00546         }
00547         if (ilvr) {
00548             zggbak_("P", "R", n, &ilo, &ihi, &rwork[ileft], &rwork[iright], n, 
00549                      &vr[vr_offset], ldvr, &ierr);
00550             i__1 = *n;
00551             for (jc = 1; jc <= i__1; ++jc) {
00552                 temp = 0.;
00553                 i__2 = *n;
00554                 for (jr = 1; jr <= i__2; ++jr) {
00555 /* Computing MAX */
00556                     i__3 = jr + jc * vr_dim1;
00557                     d__3 = temp, d__4 = (d__1 = vr[i__3].r, abs(d__1)) + (
00558                             d__2 = d_imag(&vr[jr + jc * vr_dim1]), abs(d__2));
00559                     temp = max(d__3,d__4);
00560 /* L40: */
00561                 }
00562                 if (temp < smlnum) {
00563                     goto L60;
00564                 }
00565                 temp = 1. / temp;
00566                 i__2 = *n;
00567                 for (jr = 1; jr <= i__2; ++jr) {
00568                     i__3 = jr + jc * vr_dim1;
00569                     i__4 = jr + jc * vr_dim1;
00570                     z__1.r = temp * vr[i__4].r, z__1.i = temp * vr[i__4].i;
00571                     vr[i__3].r = z__1.r, vr[i__3].i = z__1.i;
00572 /* L50: */
00573                 }
00574 L60:
00575                 ;
00576             }
00577         }
00578     }
00579 
00580 /*     Undo scaling if necessary */
00581 
00582     if (ilascl) {
00583         zlascl_("G", &c__0, &c__0, &anrmto, &anrm, n, &c__1, &alpha[1], n, &
00584                 ierr);
00585     }
00586 
00587     if (ilbscl) {
00588         zlascl_("G", &c__0, &c__0, &bnrmto, &bnrm, n, &c__1, &beta[1], n, &
00589                 ierr);
00590     }
00591 
00592 L70:
00593     work[1].r = (doublereal) lwkopt, work[1].i = 0.;
00594 
00595     return 0;
00596 
00597 /*     End of ZGGEV */
00598 
00599 } /* zggev_ */


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:56:36