dgeev.c
Go to the documentation of this file.
00001 /* dgeev.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 
00022 /* Subroutine */ int dgeev_(char *jobvl, char *jobvr, integer *n, doublereal *
00023         a, integer *lda, doublereal *wr, doublereal *wi, doublereal *vl, 
00024         integer *ldvl, doublereal *vr, integer *ldvr, doublereal *work, 
00025         integer *lwork, integer *info)
00026 {
00027     /* System generated locals */
00028     integer a_dim1, a_offset, vl_dim1, vl_offset, vr_dim1, vr_offset, i__1, 
00029             i__2, i__3;
00030     doublereal d__1, d__2;
00031 
00032     /* Builtin functions */
00033     double sqrt(doublereal);
00034 
00035     /* Local variables */
00036     integer i__, k;
00037     doublereal r__, cs, sn;
00038     integer ihi;
00039     doublereal scl;
00040     integer ilo;
00041     doublereal dum[1], eps;
00042     integer ibal;
00043     char side[1];
00044     doublereal anrm;
00045     integer ierr, itau;
00046     extern /* Subroutine */ int drot_(integer *, doublereal *, integer *, 
00047             doublereal *, integer *, doublereal *, doublereal *);
00048     integer iwrk, nout;
00049     extern doublereal dnrm2_(integer *, doublereal *, integer *);
00050     extern /* Subroutine */ int dscal_(integer *, doublereal *, doublereal *, 
00051             integer *);
00052     extern logical lsame_(char *, char *);
00053     extern doublereal dlapy2_(doublereal *, doublereal *);
00054     extern /* Subroutine */ int dlabad_(doublereal *, doublereal *), dgebak_(
00055             char *, char *, integer *, integer *, integer *, doublereal *, 
00056             integer *, doublereal *, integer *, integer *), 
00057             dgebal_(char *, integer *, doublereal *, integer *, integer *, 
00058             integer *, doublereal *, integer *);
00059     logical scalea;
00060     extern doublereal dlamch_(char *);
00061     doublereal cscale;
00062     extern doublereal dlange_(char *, integer *, integer *, doublereal *, 
00063             integer *, doublereal *);
00064     extern /* Subroutine */ int dgehrd_(integer *, integer *, integer *, 
00065             doublereal *, integer *, doublereal *, doublereal *, integer *, 
00066             integer *), dlascl_(char *, integer *, integer *, doublereal *, 
00067             doublereal *, integer *, integer *, doublereal *, integer *, 
00068             integer *);
00069     extern integer idamax_(integer *, doublereal *, integer *);
00070     extern /* Subroutine */ int dlacpy_(char *, integer *, integer *, 
00071             doublereal *, integer *, doublereal *, integer *), 
00072             dlartg_(doublereal *, doublereal *, doublereal *, doublereal *, 
00073             doublereal *), xerbla_(char *, integer *);
00074     logical select[1];
00075     extern integer ilaenv_(integer *, char *, char *, integer *, integer *, 
00076             integer *, integer *);
00077     doublereal bignum;
00078     extern /* Subroutine */ int dorghr_(integer *, integer *, integer *, 
00079             doublereal *, integer *, doublereal *, doublereal *, integer *, 
00080             integer *), dhseqr_(char *, char *, integer *, integer *, integer 
00081             *, doublereal *, integer *, doublereal *, doublereal *, 
00082             doublereal *, integer *, doublereal *, integer *, integer *), dtrevc_(char *, char *, logical *, integer *, 
00083             doublereal *, integer *, doublereal *, integer *, doublereal *, 
00084             integer *, integer *, integer *, doublereal *, integer *);
00085     integer minwrk, maxwrk;
00086     logical wantvl;
00087     doublereal smlnum;
00088     integer hswork;
00089     logical lquery, wantvr;
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 /*  DGEEV computes for an N-by-N real nonsymmetric matrix A, the */
00105 /*  eigenvalues and, optionally, the left and/or right eigenvectors. */
00106 
00107 /*  The right eigenvector v(j) of A satisfies */
00108 /*                   A * v(j) = lambda(j) * v(j) */
00109 /*  where lambda(j) is its eigenvalue. */
00110 /*  The left eigenvector u(j) of A satisfies */
00111 /*                u(j)**H * A = lambda(j) * u(j)**H */
00112 /*  where u(j)**H denotes the conjugate transpose of u(j). */
00113 
00114 /*  The computed eigenvectors are normalized to have Euclidean norm */
00115 /*  equal to 1 and largest component real. */
00116 
00117 /*  Arguments */
00118 /*  ========= */
00119 
00120 /*  JOBVL   (input) CHARACTER*1 */
00121 /*          = 'N': left eigenvectors of A are not computed; */
00122 /*          = 'V': left eigenvectors of A are computed. */
00123 
00124 /*  JOBVR   (input) CHARACTER*1 */
00125 /*          = 'N': right eigenvectors of A are not computed; */
00126 /*          = 'V': right eigenvectors of A are computed. */
00127 
00128 /*  N       (input) INTEGER */
00129 /*          The order of the matrix A. N >= 0. */
00130 
00131 /*  A       (input/output) DOUBLE PRECISION array, dimension (LDA,N) */
00132 /*          On entry, the N-by-N matrix A. */
00133 /*          On exit, A has been overwritten. */
00134 
00135 /*  LDA     (input) INTEGER */
00136 /*          The leading dimension of the array A.  LDA >= max(1,N). */
00137 
00138 /*  WR      (output) DOUBLE PRECISION array, dimension (N) */
00139 /*  WI      (output) DOUBLE PRECISION array, dimension (N) */
00140 /*          WR and WI contain the real and imaginary parts, */
00141 /*          respectively, of the computed eigenvalues.  Complex */
00142 /*          conjugate pairs of eigenvalues appear consecutively */
00143 /*          with the eigenvalue having the positive imaginary part */
00144 /*          first. */
00145 
00146 /*  VL      (output) DOUBLE PRECISION array, dimension (LDVL,N) */
00147 /*          If JOBVL = 'V', the left eigenvectors u(j) are stored one */
00148 /*          after another in the columns of VL, in the same order */
00149 /*          as their eigenvalues. */
00150 /*          If JOBVL = 'N', VL is not referenced. */
00151 /*          If the j-th eigenvalue is real, then u(j) = VL(:,j), */
00152 /*          the j-th column of VL. */
00153 /*          If the j-th and (j+1)-st eigenvalues form a complex */
00154 /*          conjugate pair, then u(j) = VL(:,j) + i*VL(:,j+1) and */
00155 /*          u(j+1) = VL(:,j) - i*VL(:,j+1). */
00156 
00157 /*  LDVL    (input) INTEGER */
00158 /*          The leading dimension of the array VL.  LDVL >= 1; if */
00159 /*          JOBVL = 'V', LDVL >= N. */
00160 
00161 /*  VR      (output) DOUBLE PRECISION array, dimension (LDVR,N) */
00162 /*          If JOBVR = 'V', the right eigenvectors v(j) are stored one */
00163 /*          after another in the columns of VR, in the same order */
00164 /*          as their eigenvalues. */
00165 /*          If JOBVR = 'N', VR is not referenced. */
00166 /*          If the j-th eigenvalue is real, then v(j) = VR(:,j), */
00167 /*          the j-th column of VR. */
00168 /*          If the j-th and (j+1)-st eigenvalues form a complex */
00169 /*          conjugate pair, then v(j) = VR(:,j) + i*VR(:,j+1) and */
00170 /*          v(j+1) = VR(:,j) - i*VR(:,j+1). */
00171 
00172 /*  LDVR    (input) INTEGER */
00173 /*          The leading dimension of the array VR.  LDVR >= 1; if */
00174 /*          JOBVR = 'V', LDVR >= N. */
00175 
00176 /*  WORK    (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK)) */
00177 /*          On exit, if INFO = 0, WORK(1) returns the optimal LWORK. */
00178 
00179 /*  LWORK   (input) INTEGER */
00180 /*          The dimension of the array WORK.  LWORK >= max(1,3*N), and */
00181 /*          if JOBVL = 'V' or JOBVR = 'V', LWORK >= 4*N.  For good */
00182 /*          performance, LWORK must generally be larger. */
00183 
00184 /*          If LWORK = -1, then a workspace query is assumed; the routine */
00185 /*          only calculates the optimal size of the WORK array, returns */
00186 /*          this value as the first entry of the WORK array, and no error */
00187 /*          message related to LWORK is issued by XERBLA. */
00188 
00189 /*  INFO    (output) INTEGER */
00190 /*          = 0:  successful exit */
00191 /*          < 0:  if INFO = -i, the i-th argument had an illegal value. */
00192 /*          > 0:  if INFO = i, the QR algorithm failed to compute all the */
00193 /*                eigenvalues, and no eigenvectors have been computed; */
00194 /*                elements i+1:N of WR and WI contain eigenvalues which */
00195 /*                have converged. */
00196 
00197 /*  ===================================================================== */
00198 
00199 /*     .. Parameters .. */
00200 /*     .. */
00201 /*     .. Local Scalars .. */
00202 /*     .. */
00203 /*     .. Local Arrays .. */
00204 /*     .. */
00205 /*     .. External Subroutines .. */
00206 /*     .. */
00207 /*     .. External Functions .. */
00208 /*     .. */
00209 /*     .. Intrinsic Functions .. */
00210 /*     .. */
00211 /*     .. Executable Statements .. */
00212 
00213 /*     Test the input arguments */
00214 
00215     /* Parameter adjustments */
00216     a_dim1 = *lda;
00217     a_offset = 1 + a_dim1;
00218     a -= a_offset;
00219     --wr;
00220     --wi;
00221     vl_dim1 = *ldvl;
00222     vl_offset = 1 + vl_dim1;
00223     vl -= vl_offset;
00224     vr_dim1 = *ldvr;
00225     vr_offset = 1 + vr_dim1;
00226     vr -= vr_offset;
00227     --work;
00228 
00229     /* Function Body */
00230     *info = 0;
00231     lquery = *lwork == -1;
00232     wantvl = lsame_(jobvl, "V");
00233     wantvr = lsame_(jobvr, "V");
00234     if (! wantvl && ! lsame_(jobvl, "N")) {
00235         *info = -1;
00236     } else if (! wantvr && ! lsame_(jobvr, "N")) {
00237         *info = -2;
00238     } else if (*n < 0) {
00239         *info = -3;
00240     } else if (*lda < max(1,*n)) {
00241         *info = -5;
00242     } else if (*ldvl < 1 || wantvl && *ldvl < *n) {
00243         *info = -9;
00244     } else if (*ldvr < 1 || wantvr && *ldvr < *n) {
00245         *info = -11;
00246     }
00247 
00248 /*     Compute workspace */
00249 /*      (Note: Comments in the code beginning "Workspace:" describe the */
00250 /*       minimal amount of workspace needed at that point in the code, */
00251 /*       as well as the preferred amount for good performance. */
00252 /*       NB refers to the optimal block size for the immediately */
00253 /*       following subroutine, as returned by ILAENV. */
00254 /*       HSWORK refers to the workspace preferred by DHSEQR, as */
00255 /*       calculated below. HSWORK is computed assuming ILO=1 and IHI=N, */
00256 /*       the worst case.) */
00257 
00258     if (*info == 0) {
00259         if (*n == 0) {
00260             minwrk = 1;
00261             maxwrk = 1;
00262         } else {
00263             maxwrk = (*n << 1) + *n * ilaenv_(&c__1, "DGEHRD", " ", n, &c__1, 
00264                     n, &c__0);
00265             if (wantvl) {
00266                 minwrk = *n << 2;
00267 /* Computing MAX */
00268                 i__1 = maxwrk, i__2 = (*n << 1) + (*n - 1) * ilaenv_(&c__1, 
00269                         "DORGHR", " ", n, &c__1, n, &c_n1);
00270                 maxwrk = max(i__1,i__2);
00271                 dhseqr_("S", "V", n, &c__1, n, &a[a_offset], lda, &wr[1], &wi[
00272                         1], &vl[vl_offset], ldvl, &work[1], &c_n1, info);
00273                 hswork = (integer) work[1];
00274 /* Computing MAX */
00275                 i__1 = maxwrk, i__2 = *n + 1, i__1 = max(i__1,i__2), i__2 = *
00276                         n + hswork;
00277                 maxwrk = max(i__1,i__2);
00278 /* Computing MAX */
00279                 i__1 = maxwrk, i__2 = *n << 2;
00280                 maxwrk = max(i__1,i__2);
00281             } else if (wantvr) {
00282                 minwrk = *n << 2;
00283 /* Computing MAX */
00284                 i__1 = maxwrk, i__2 = (*n << 1) + (*n - 1) * ilaenv_(&c__1, 
00285                         "DORGHR", " ", n, &c__1, n, &c_n1);
00286                 maxwrk = max(i__1,i__2);
00287                 dhseqr_("S", "V", n, &c__1, n, &a[a_offset], lda, &wr[1], &wi[
00288                         1], &vr[vr_offset], ldvr, &work[1], &c_n1, info);
00289                 hswork = (integer) work[1];
00290 /* Computing MAX */
00291                 i__1 = maxwrk, i__2 = *n + 1, i__1 = max(i__1,i__2), i__2 = *
00292                         n + hswork;
00293                 maxwrk = max(i__1,i__2);
00294 /* Computing MAX */
00295                 i__1 = maxwrk, i__2 = *n << 2;
00296                 maxwrk = max(i__1,i__2);
00297             } else {
00298                 minwrk = *n * 3;
00299                 dhseqr_("E", "N", n, &c__1, n, &a[a_offset], lda, &wr[1], &wi[
00300                         1], &vr[vr_offset], ldvr, &work[1], &c_n1, info);
00301                 hswork = (integer) work[1];
00302 /* Computing MAX */
00303                 i__1 = maxwrk, i__2 = *n + 1, i__1 = max(i__1,i__2), i__2 = *
00304                         n + hswork;
00305                 maxwrk = max(i__1,i__2);
00306             }
00307             maxwrk = max(maxwrk,minwrk);
00308         }
00309         work[1] = (doublereal) maxwrk;
00310 
00311         if (*lwork < minwrk && ! lquery) {
00312             *info = -13;
00313         }
00314     }
00315 
00316     if (*info != 0) {
00317         i__1 = -(*info);
00318         xerbla_("DGEEV ", &i__1);
00319         return 0;
00320     } else if (lquery) {
00321         return 0;
00322     }
00323 
00324 /*     Quick return if possible */
00325 
00326     if (*n == 0) {
00327         return 0;
00328     }
00329 
00330 /*     Get machine constants */
00331 
00332     eps = dlamch_("P");
00333     smlnum = dlamch_("S");
00334     bignum = 1. / smlnum;
00335     dlabad_(&smlnum, &bignum);
00336     smlnum = sqrt(smlnum) / eps;
00337     bignum = 1. / smlnum;
00338 
00339 /*     Scale A if max element outside range [SMLNUM,BIGNUM] */
00340 
00341     anrm = dlange_("M", n, n, &a[a_offset], lda, dum);
00342     scalea = FALSE_;
00343     if (anrm > 0. && anrm < smlnum) {
00344         scalea = TRUE_;
00345         cscale = smlnum;
00346     } else if (anrm > bignum) {
00347         scalea = TRUE_;
00348         cscale = bignum;
00349     }
00350     if (scalea) {
00351         dlascl_("G", &c__0, &c__0, &anrm, &cscale, n, n, &a[a_offset], lda, &
00352                 ierr);
00353     }
00354 
00355 /*     Balance the matrix */
00356 /*     (Workspace: need N) */
00357 
00358     ibal = 1;
00359     dgebal_("B", n, &a[a_offset], lda, &ilo, &ihi, &work[ibal], &ierr);
00360 
00361 /*     Reduce to upper Hessenberg form */
00362 /*     (Workspace: need 3*N, prefer 2*N+N*NB) */
00363 
00364     itau = ibal + *n;
00365     iwrk = itau + *n;
00366     i__1 = *lwork - iwrk + 1;
00367     dgehrd_(n, &ilo, &ihi, &a[a_offset], lda, &work[itau], &work[iwrk], &i__1, 
00368              &ierr);
00369 
00370     if (wantvl) {
00371 
00372 /*        Want left eigenvectors */
00373 /*        Copy Householder vectors to VL */
00374 
00375         *(unsigned char *)side = 'L';
00376         dlacpy_("L", n, n, &a[a_offset], lda, &vl[vl_offset], ldvl)
00377                 ;
00378 
00379 /*        Generate orthogonal matrix in VL */
00380 /*        (Workspace: need 3*N-1, prefer 2*N+(N-1)*NB) */
00381 
00382         i__1 = *lwork - iwrk + 1;
00383         dorghr_(n, &ilo, &ihi, &vl[vl_offset], ldvl, &work[itau], &work[iwrk], 
00384                  &i__1, &ierr);
00385 
00386 /*        Perform QR iteration, accumulating Schur vectors in VL */
00387 /*        (Workspace: need N+1, prefer N+HSWORK (see comments) ) */
00388 
00389         iwrk = itau;
00390         i__1 = *lwork - iwrk + 1;
00391         dhseqr_("S", "V", n, &ilo, &ihi, &a[a_offset], lda, &wr[1], &wi[1], &
00392                 vl[vl_offset], ldvl, &work[iwrk], &i__1, info);
00393 
00394         if (wantvr) {
00395 
00396 /*           Want left and right eigenvectors */
00397 /*           Copy Schur vectors to VR */
00398 
00399             *(unsigned char *)side = 'B';
00400             dlacpy_("F", n, n, &vl[vl_offset], ldvl, &vr[vr_offset], ldvr);
00401         }
00402 
00403     } else if (wantvr) {
00404 
00405 /*        Want right eigenvectors */
00406 /*        Copy Householder vectors to VR */
00407 
00408         *(unsigned char *)side = 'R';
00409         dlacpy_("L", n, n, &a[a_offset], lda, &vr[vr_offset], ldvr)
00410                 ;
00411 
00412 /*        Generate orthogonal matrix in VR */
00413 /*        (Workspace: need 3*N-1, prefer 2*N+(N-1)*NB) */
00414 
00415         i__1 = *lwork - iwrk + 1;
00416         dorghr_(n, &ilo, &ihi, &vr[vr_offset], ldvr, &work[itau], &work[iwrk], 
00417                  &i__1, &ierr);
00418 
00419 /*        Perform QR iteration, accumulating Schur vectors in VR */
00420 /*        (Workspace: need N+1, prefer N+HSWORK (see comments) ) */
00421 
00422         iwrk = itau;
00423         i__1 = *lwork - iwrk + 1;
00424         dhseqr_("S", "V", n, &ilo, &ihi, &a[a_offset], lda, &wr[1], &wi[1], &
00425                 vr[vr_offset], ldvr, &work[iwrk], &i__1, info);
00426 
00427     } else {
00428 
00429 /*        Compute eigenvalues only */
00430 /*        (Workspace: need N+1, prefer N+HSWORK (see comments) ) */
00431 
00432         iwrk = itau;
00433         i__1 = *lwork - iwrk + 1;
00434         dhseqr_("E", "N", n, &ilo, &ihi, &a[a_offset], lda, &wr[1], &wi[1], &
00435                 vr[vr_offset], ldvr, &work[iwrk], &i__1, info);
00436     }
00437 
00438 /*     If INFO > 0 from DHSEQR, then quit */
00439 
00440     if (*info > 0) {
00441         goto L50;
00442     }
00443 
00444     if (wantvl || wantvr) {
00445 
00446 /*        Compute left and/or right eigenvectors */
00447 /*        (Workspace: need 4*N) */
00448 
00449         dtrevc_(side, "B", select, n, &a[a_offset], lda, &vl[vl_offset], ldvl, 
00450                  &vr[vr_offset], ldvr, n, &nout, &work[iwrk], &ierr);
00451     }
00452 
00453     if (wantvl) {
00454 
00455 /*        Undo balancing of left eigenvectors */
00456 /*        (Workspace: need N) */
00457 
00458         dgebak_("B", "L", n, &ilo, &ihi, &work[ibal], n, &vl[vl_offset], ldvl, 
00459                  &ierr);
00460 
00461 /*        Normalize left eigenvectors and make largest component real */
00462 
00463         i__1 = *n;
00464         for (i__ = 1; i__ <= i__1; ++i__) {
00465             if (wi[i__] == 0.) {
00466                 scl = 1. / dnrm2_(n, &vl[i__ * vl_dim1 + 1], &c__1);
00467                 dscal_(n, &scl, &vl[i__ * vl_dim1 + 1], &c__1);
00468             } else if (wi[i__] > 0.) {
00469                 d__1 = dnrm2_(n, &vl[i__ * vl_dim1 + 1], &c__1);
00470                 d__2 = dnrm2_(n, &vl[(i__ + 1) * vl_dim1 + 1], &c__1);
00471                 scl = 1. / dlapy2_(&d__1, &d__2);
00472                 dscal_(n, &scl, &vl[i__ * vl_dim1 + 1], &c__1);
00473                 dscal_(n, &scl, &vl[(i__ + 1) * vl_dim1 + 1], &c__1);
00474                 i__2 = *n;
00475                 for (k = 1; k <= i__2; ++k) {
00476 /* Computing 2nd power */
00477                     d__1 = vl[k + i__ * vl_dim1];
00478 /* Computing 2nd power */
00479                     d__2 = vl[k + (i__ + 1) * vl_dim1];
00480                     work[iwrk + k - 1] = d__1 * d__1 + d__2 * d__2;
00481 /* L10: */
00482                 }
00483                 k = idamax_(n, &work[iwrk], &c__1);
00484                 dlartg_(&vl[k + i__ * vl_dim1], &vl[k + (i__ + 1) * vl_dim1], 
00485                         &cs, &sn, &r__);
00486                 drot_(n, &vl[i__ * vl_dim1 + 1], &c__1, &vl[(i__ + 1) * 
00487                         vl_dim1 + 1], &c__1, &cs, &sn);
00488                 vl[k + (i__ + 1) * vl_dim1] = 0.;
00489             }
00490 /* L20: */
00491         }
00492     }
00493 
00494     if (wantvr) {
00495 
00496 /*        Undo balancing of right eigenvectors */
00497 /*        (Workspace: need N) */
00498 
00499         dgebak_("B", "R", n, &ilo, &ihi, &work[ibal], n, &vr[vr_offset], ldvr, 
00500                  &ierr);
00501 
00502 /*        Normalize right eigenvectors and make largest component real */
00503 
00504         i__1 = *n;
00505         for (i__ = 1; i__ <= i__1; ++i__) {
00506             if (wi[i__] == 0.) {
00507                 scl = 1. / dnrm2_(n, &vr[i__ * vr_dim1 + 1], &c__1);
00508                 dscal_(n, &scl, &vr[i__ * vr_dim1 + 1], &c__1);
00509             } else if (wi[i__] > 0.) {
00510                 d__1 = dnrm2_(n, &vr[i__ * vr_dim1 + 1], &c__1);
00511                 d__2 = dnrm2_(n, &vr[(i__ + 1) * vr_dim1 + 1], &c__1);
00512                 scl = 1. / dlapy2_(&d__1, &d__2);
00513                 dscal_(n, &scl, &vr[i__ * vr_dim1 + 1], &c__1);
00514                 dscal_(n, &scl, &vr[(i__ + 1) * vr_dim1 + 1], &c__1);
00515                 i__2 = *n;
00516                 for (k = 1; k <= i__2; ++k) {
00517 /* Computing 2nd power */
00518                     d__1 = vr[k + i__ * vr_dim1];
00519 /* Computing 2nd power */
00520                     d__2 = vr[k + (i__ + 1) * vr_dim1];
00521                     work[iwrk + k - 1] = d__1 * d__1 + d__2 * d__2;
00522 /* L30: */
00523                 }
00524                 k = idamax_(n, &work[iwrk], &c__1);
00525                 dlartg_(&vr[k + i__ * vr_dim1], &vr[k + (i__ + 1) * vr_dim1], 
00526                         &cs, &sn, &r__);
00527                 drot_(n, &vr[i__ * vr_dim1 + 1], &c__1, &vr[(i__ + 1) * 
00528                         vr_dim1 + 1], &c__1, &cs, &sn);
00529                 vr[k + (i__ + 1) * vr_dim1] = 0.;
00530             }
00531 /* L40: */
00532         }
00533     }
00534 
00535 /*     Undo scaling if necessary */
00536 
00537 L50:
00538     if (scalea) {
00539         i__1 = *n - *info;
00540 /* Computing MAX */
00541         i__3 = *n - *info;
00542         i__2 = max(i__3,1);
00543         dlascl_("G", &c__0, &c__0, &cscale, &anrm, &i__1, &c__1, &wr[*info + 
00544                 1], &i__2, &ierr);
00545         i__1 = *n - *info;
00546 /* Computing MAX */
00547         i__3 = *n - *info;
00548         i__2 = max(i__3,1);
00549         dlascl_("G", &c__0, &c__0, &cscale, &anrm, &i__1, &c__1, &wi[*info + 
00550                 1], &i__2, &ierr);
00551         if (*info > 0) {
00552             i__1 = ilo - 1;
00553             dlascl_("G", &c__0, &c__0, &cscale, &anrm, &i__1, &c__1, &wr[1], 
00554                     n, &ierr);
00555             i__1 = ilo - 1;
00556             dlascl_("G", &c__0, &c__0, &cscale, &anrm, &i__1, &c__1, &wi[1], 
00557                     n, &ierr);
00558         }
00559     }
00560 
00561     work[1] = (doublereal) maxwrk;
00562     return 0;
00563 
00564 /*     End of DGEEV */
00565 
00566 } /* dgeev_ */


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:55:43