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


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