dtrevc.c
Go to the documentation of this file.
00001 /* dtrevc.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 logical c_false = FALSE_;
00019 static integer c__1 = 1;
00020 static doublereal c_b22 = 1.;
00021 static doublereal c_b25 = 0.;
00022 static integer c__2 = 2;
00023 static logical c_true = TRUE_;
00024 
00025 /* Subroutine */ int dtrevc_(char *side, char *howmny, logical *select, 
00026         integer *n, doublereal *t, integer *ldt, doublereal *vl, integer *
00027         ldvl, doublereal *vr, integer *ldvr, integer *mm, integer *m, 
00028         doublereal *work, integer *info)
00029 {
00030     /* System generated locals */
00031     integer t_dim1, t_offset, vl_dim1, vl_offset, vr_dim1, vr_offset, i__1, 
00032             i__2, i__3;
00033     doublereal d__1, d__2, d__3, d__4;
00034 
00035     /* Builtin functions */
00036     double sqrt(doublereal);
00037 
00038     /* Local variables */
00039     integer i__, j, k;
00040     doublereal x[4]     /* was [2][2] */;
00041     integer j1, j2, n2, ii, ki, ip, is;
00042     doublereal wi, wr, rec, ulp, beta, emax;
00043     logical pair;
00044     extern doublereal ddot_(integer *, doublereal *, integer *, doublereal *, 
00045             integer *);
00046     logical allv;
00047     integer ierr;
00048     doublereal unfl, ovfl, smin;
00049     logical over;
00050     doublereal vmax;
00051     integer jnxt;
00052     extern /* Subroutine */ int dscal_(integer *, doublereal *, doublereal *, 
00053             integer *);
00054     doublereal scale;
00055     extern logical lsame_(char *, char *);
00056     extern /* Subroutine */ int dgemv_(char *, integer *, integer *, 
00057             doublereal *, doublereal *, integer *, doublereal *, integer *, 
00058             doublereal *, doublereal *, integer *);
00059     doublereal remax;
00060     extern /* Subroutine */ int dcopy_(integer *, doublereal *, integer *, 
00061             doublereal *, integer *);
00062     logical leftv, bothv;
00063     extern /* Subroutine */ int daxpy_(integer *, doublereal *, doublereal *, 
00064             integer *, doublereal *, integer *);
00065     doublereal vcrit;
00066     logical somev;
00067     doublereal xnorm;
00068     extern /* Subroutine */ int dlaln2_(logical *, integer *, integer *, 
00069             doublereal *, doublereal *, doublereal *, integer *, doublereal *, 
00070              doublereal *, doublereal *, integer *, doublereal *, doublereal *
00071 , doublereal *, integer *, doublereal *, doublereal *, integer *),
00072              dlabad_(doublereal *, doublereal *);
00073     extern doublereal dlamch_(char *);
00074     extern integer idamax_(integer *, doublereal *, integer *);
00075     extern /* Subroutine */ int xerbla_(char *, integer *);
00076     doublereal bignum;
00077     logical rightv;
00078     doublereal smlnum;
00079 
00080 
00081 /*  -- LAPACK routine (version 3.2) -- */
00082 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00083 /*     November 2006 */
00084 
00085 /*     .. Scalar Arguments .. */
00086 /*     .. */
00087 /*     .. Array Arguments .. */
00088 /*     .. */
00089 
00090 /*  Purpose */
00091 /*  ======= */
00092 
00093 /*  DTREVC computes some or all of the right and/or left eigenvectors of */
00094 /*  a real upper quasi-triangular matrix T. */
00095 /*  Matrices of this type are produced by the Schur factorization of */
00096 /*  a real general matrix:  A = Q*T*Q**T, as computed by DHSEQR. */
00097 
00098 /*  The right eigenvector x and the left eigenvector y of T corresponding */
00099 /*  to an eigenvalue w are defined by: */
00100 
00101 /*     T*x = w*x,     (y**H)*T = w*(y**H) */
00102 
00103 /*  where y**H denotes the conjugate transpose of y. */
00104 /*  The eigenvalues are not input to this routine, but are read directly */
00105 /*  from the diagonal blocks of T. */
00106 
00107 /*  This routine returns the matrices X and/or Y of right and left */
00108 /*  eigenvectors of T, or the products Q*X and/or Q*Y, where Q is an */
00109 /*  input matrix.  If Q is the orthogonal factor that reduces a matrix */
00110 /*  A to Schur form T, then Q*X and Q*Y are the matrices of right and */
00111 /*  left eigenvectors of A. */
00112 
00113 /*  Arguments */
00114 /*  ========= */
00115 
00116 /*  SIDE    (input) CHARACTER*1 */
00117 /*          = 'R':  compute right eigenvectors only; */
00118 /*          = 'L':  compute left eigenvectors only; */
00119 /*          = 'B':  compute both right and left eigenvectors. */
00120 
00121 /*  HOWMNY  (input) CHARACTER*1 */
00122 /*          = 'A':  compute all right and/or left eigenvectors; */
00123 /*          = 'B':  compute all right and/or left eigenvectors, */
00124 /*                  backtransformed by the matrices in VR and/or VL; */
00125 /*          = 'S':  compute selected right and/or left eigenvectors, */
00126 /*                  as indicated by the logical array SELECT. */
00127 
00128 /*  SELECT  (input/output) LOGICAL array, dimension (N) */
00129 /*          If HOWMNY = 'S', SELECT specifies the eigenvectors to be */
00130 /*          computed. */
00131 /*          If w(j) is a real eigenvalue, the corresponding real */
00132 /*          eigenvector is computed if SELECT(j) is .TRUE.. */
00133 /*          If w(j) and w(j+1) are the real and imaginary parts of a */
00134 /*          complex eigenvalue, the corresponding complex eigenvector is */
00135 /*          computed if either SELECT(j) or SELECT(j+1) is .TRUE., and */
00136 /*          on exit SELECT(j) is set to .TRUE. and SELECT(j+1) is set to */
00137 /*          .FALSE.. */
00138 /*          Not referenced if HOWMNY = 'A' or 'B'. */
00139 
00140 /*  N       (input) INTEGER */
00141 /*          The order of the matrix T. N >= 0. */
00142 
00143 /*  T       (input) DOUBLE PRECISION array, dimension (LDT,N) */
00144 /*          The upper quasi-triangular matrix T in Schur canonical form. */
00145 
00146 /*  LDT     (input) INTEGER */
00147 /*          The leading dimension of the array T. LDT >= max(1,N). */
00148 
00149 /*  VL      (input/output) DOUBLE PRECISION array, dimension (LDVL,MM) */
00150 /*          On entry, if SIDE = 'L' or 'B' and HOWMNY = 'B', VL must */
00151 /*          contain an N-by-N matrix Q (usually the orthogonal matrix Q */
00152 /*          of Schur vectors returned by DHSEQR). */
00153 /*          On exit, if SIDE = 'L' or 'B', VL contains: */
00154 /*          if HOWMNY = 'A', the matrix Y of left eigenvectors of T; */
00155 /*          if HOWMNY = 'B', the matrix Q*Y; */
00156 /*          if HOWMNY = 'S', the left eigenvectors of T specified by */
00157 /*                           SELECT, stored consecutively in the columns */
00158 /*                           of VL, in the same order as their */
00159 /*                           eigenvalues. */
00160 /*          A complex eigenvector corresponding to a complex eigenvalue */
00161 /*          is stored in two consecutive columns, the first holding the */
00162 /*          real part, and the second the imaginary part. */
00163 /*          Not referenced if SIDE = 'R'. */
00164 
00165 /*  LDVL    (input) INTEGER */
00166 /*          The leading dimension of the array VL.  LDVL >= 1, and if */
00167 /*          SIDE = 'L' or 'B', LDVL >= N. */
00168 
00169 /*  VR      (input/output) DOUBLE PRECISION array, dimension (LDVR,MM) */
00170 /*          On entry, if SIDE = 'R' or 'B' and HOWMNY = 'B', VR must */
00171 /*          contain an N-by-N matrix Q (usually the orthogonal matrix Q */
00172 /*          of Schur vectors returned by DHSEQR). */
00173 /*          On exit, if SIDE = 'R' or 'B', VR contains: */
00174 /*          if HOWMNY = 'A', the matrix X of right eigenvectors of T; */
00175 /*          if HOWMNY = 'B', the matrix Q*X; */
00176 /*          if HOWMNY = 'S', the right eigenvectors of T specified by */
00177 /*                           SELECT, stored consecutively in the columns */
00178 /*                           of VR, in the same order as their */
00179 /*                           eigenvalues. */
00180 /*          A complex eigenvector corresponding to a complex eigenvalue */
00181 /*          is stored in two consecutive columns, the first holding the */
00182 /*          real part and the second the imaginary part. */
00183 /*          Not referenced if SIDE = 'L'. */
00184 
00185 /*  LDVR    (input) INTEGER */
00186 /*          The leading dimension of the array VR.  LDVR >= 1, and if */
00187 /*          SIDE = 'R' or 'B', LDVR >= N. */
00188 
00189 /*  MM      (input) INTEGER */
00190 /*          The number of columns in the arrays VL and/or VR. MM >= M. */
00191 
00192 /*  M       (output) INTEGER */
00193 /*          The number of columns in the arrays VL and/or VR actually */
00194 /*          used to store the eigenvectors. */
00195 /*          If HOWMNY = 'A' or 'B', M is set to N. */
00196 /*          Each selected real eigenvector occupies one column and each */
00197 /*          selected complex eigenvector occupies two columns. */
00198 
00199 /*  WORK    (workspace) DOUBLE PRECISION array, dimension (3*N) */
00200 
00201 /*  INFO    (output) INTEGER */
00202 /*          = 0:  successful exit */
00203 /*          < 0:  if INFO = -i, the i-th argument had an illegal value */
00204 
00205 /*  Further Details */
00206 /*  =============== */
00207 
00208 /*  The algorithm used in this program is basically backward (forward) */
00209 /*  substitution, with scaling to make the the code robust against */
00210 /*  possible overflow. */
00211 
00212 /*  Each eigenvector is normalized so that the element of largest */
00213 /*  magnitude has magnitude 1; here the magnitude of a complex number */
00214 /*  (x,y) is taken to be |x| + |y|. */
00215 
00216 /*  ===================================================================== */
00217 
00218 /*     .. Parameters .. */
00219 /*     .. */
00220 /*     .. Local Scalars .. */
00221 /*     .. */
00222 /*     .. External Functions .. */
00223 /*     .. */
00224 /*     .. External Subroutines .. */
00225 /*     .. */
00226 /*     .. Intrinsic Functions .. */
00227 /*     .. */
00228 /*     .. Local Arrays .. */
00229 /*     .. */
00230 /*     .. Executable Statements .. */
00231 
00232 /*     Decode and test the input parameters */
00233 
00234     /* Parameter adjustments */
00235     --select;
00236     t_dim1 = *ldt;
00237     t_offset = 1 + t_dim1;
00238     t -= t_offset;
00239     vl_dim1 = *ldvl;
00240     vl_offset = 1 + vl_dim1;
00241     vl -= vl_offset;
00242     vr_dim1 = *ldvr;
00243     vr_offset = 1 + vr_dim1;
00244     vr -= vr_offset;
00245     --work;
00246 
00247     /* Function Body */
00248     bothv = lsame_(side, "B");
00249     rightv = lsame_(side, "R") || bothv;
00250     leftv = lsame_(side, "L") || bothv;
00251 
00252     allv = lsame_(howmny, "A");
00253     over = lsame_(howmny, "B");
00254     somev = lsame_(howmny, "S");
00255 
00256     *info = 0;
00257     if (! rightv && ! leftv) {
00258         *info = -1;
00259     } else if (! allv && ! over && ! somev) {
00260         *info = -2;
00261     } else if (*n < 0) {
00262         *info = -4;
00263     } else if (*ldt < max(1,*n)) {
00264         *info = -6;
00265     } else if (*ldvl < 1 || leftv && *ldvl < *n) {
00266         *info = -8;
00267     } else if (*ldvr < 1 || rightv && *ldvr < *n) {
00268         *info = -10;
00269     } else {
00270 
00271 /*        Set M to the number of columns required to store the selected */
00272 /*        eigenvectors, standardize the array SELECT if necessary, and */
00273 /*        test MM. */
00274 
00275         if (somev) {
00276             *m = 0;
00277             pair = FALSE_;
00278             i__1 = *n;
00279             for (j = 1; j <= i__1; ++j) {
00280                 if (pair) {
00281                     pair = FALSE_;
00282                     select[j] = FALSE_;
00283                 } else {
00284                     if (j < *n) {
00285                         if (t[j + 1 + j * t_dim1] == 0.) {
00286                             if (select[j]) {
00287                                 ++(*m);
00288                             }
00289                         } else {
00290                             pair = TRUE_;
00291                             if (select[j] || select[j + 1]) {
00292                                 select[j] = TRUE_;
00293                                 *m += 2;
00294                             }
00295                         }
00296                     } else {
00297                         if (select[*n]) {
00298                             ++(*m);
00299                         }
00300                     }
00301                 }
00302 /* L10: */
00303             }
00304         } else {
00305             *m = *n;
00306         }
00307 
00308         if (*mm < *m) {
00309             *info = -11;
00310         }
00311     }
00312     if (*info != 0) {
00313         i__1 = -(*info);
00314         xerbla_("DTREVC", &i__1);
00315         return 0;
00316     }
00317 
00318 /*     Quick return if possible. */
00319 
00320     if (*n == 0) {
00321         return 0;
00322     }
00323 
00324 /*     Set the constants to control overflow. */
00325 
00326     unfl = dlamch_("Safe minimum");
00327     ovfl = 1. / unfl;
00328     dlabad_(&unfl, &ovfl);
00329     ulp = dlamch_("Precision");
00330     smlnum = unfl * (*n / ulp);
00331     bignum = (1. - ulp) / smlnum;
00332 
00333 /*     Compute 1-norm of each column of strictly upper triangular */
00334 /*     part of T to control overflow in triangular solver. */
00335 
00336     work[1] = 0.;
00337     i__1 = *n;
00338     for (j = 2; j <= i__1; ++j) {
00339         work[j] = 0.;
00340         i__2 = j - 1;
00341         for (i__ = 1; i__ <= i__2; ++i__) {
00342             work[j] += (d__1 = t[i__ + j * t_dim1], abs(d__1));
00343 /* L20: */
00344         }
00345 /* L30: */
00346     }
00347 
00348 /*     Index IP is used to specify the real or complex eigenvalue: */
00349 /*       IP = 0, real eigenvalue, */
00350 /*            1, first of conjugate complex pair: (wr,wi) */
00351 /*           -1, second of conjugate complex pair: (wr,wi) */
00352 
00353     n2 = *n << 1;
00354 
00355     if (rightv) {
00356 
00357 /*        Compute right eigenvectors. */
00358 
00359         ip = 0;
00360         is = *m;
00361         for (ki = *n; ki >= 1; --ki) {
00362 
00363             if (ip == 1) {
00364                 goto L130;
00365             }
00366             if (ki == 1) {
00367                 goto L40;
00368             }
00369             if (t[ki + (ki - 1) * t_dim1] == 0.) {
00370                 goto L40;
00371             }
00372             ip = -1;
00373 
00374 L40:
00375             if (somev) {
00376                 if (ip == 0) {
00377                     if (! select[ki]) {
00378                         goto L130;
00379                     }
00380                 } else {
00381                     if (! select[ki - 1]) {
00382                         goto L130;
00383                     }
00384                 }
00385             }
00386 
00387 /*           Compute the KI-th eigenvalue (WR,WI). */
00388 
00389             wr = t[ki + ki * t_dim1];
00390             wi = 0.;
00391             if (ip != 0) {
00392                 wi = sqrt((d__1 = t[ki + (ki - 1) * t_dim1], abs(d__1))) * 
00393                         sqrt((d__2 = t[ki - 1 + ki * t_dim1], abs(d__2)));
00394             }
00395 /* Computing MAX */
00396             d__1 = ulp * (abs(wr) + abs(wi));
00397             smin = max(d__1,smlnum);
00398 
00399             if (ip == 0) {
00400 
00401 /*              Real right eigenvector */
00402 
00403                 work[ki + *n] = 1.;
00404 
00405 /*              Form right-hand side */
00406 
00407                 i__1 = ki - 1;
00408                 for (k = 1; k <= i__1; ++k) {
00409                     work[k + *n] = -t[k + ki * t_dim1];
00410 /* L50: */
00411                 }
00412 
00413 /*              Solve the upper quasi-triangular system: */
00414 /*                 (T(1:KI-1,1:KI-1) - WR)*X = SCALE*WORK. */
00415 
00416                 jnxt = ki - 1;
00417                 for (j = ki - 1; j >= 1; --j) {
00418                     if (j > jnxt) {
00419                         goto L60;
00420                     }
00421                     j1 = j;
00422                     j2 = j;
00423                     jnxt = j - 1;
00424                     if (j > 1) {
00425                         if (t[j + (j - 1) * t_dim1] != 0.) {
00426                             j1 = j - 1;
00427                             jnxt = j - 2;
00428                         }
00429                     }
00430 
00431                     if (j1 == j2) {
00432 
00433 /*                    1-by-1 diagonal block */
00434 
00435                         dlaln2_(&c_false, &c__1, &c__1, &smin, &c_b22, &t[j + 
00436                                 j * t_dim1], ldt, &c_b22, &c_b22, &work[j + *
00437                                 n], n, &wr, &c_b25, x, &c__2, &scale, &xnorm, 
00438                                 &ierr);
00439 
00440 /*                    Scale X(1,1) to avoid overflow when updating */
00441 /*                    the right-hand side. */
00442 
00443                         if (xnorm > 1.) {
00444                             if (work[j] > bignum / xnorm) {
00445                                 x[0] /= xnorm;
00446                                 scale /= xnorm;
00447                             }
00448                         }
00449 
00450 /*                    Scale if necessary */
00451 
00452                         if (scale != 1.) {
00453                             dscal_(&ki, &scale, &work[*n + 1], &c__1);
00454                         }
00455                         work[j + *n] = x[0];
00456 
00457 /*                    Update right-hand side */
00458 
00459                         i__1 = j - 1;
00460                         d__1 = -x[0];
00461                         daxpy_(&i__1, &d__1, &t[j * t_dim1 + 1], &c__1, &work[
00462                                 *n + 1], &c__1);
00463 
00464                     } else {
00465 
00466 /*                    2-by-2 diagonal block */
00467 
00468                         dlaln2_(&c_false, &c__2, &c__1, &smin, &c_b22, &t[j - 
00469                                 1 + (j - 1) * t_dim1], ldt, &c_b22, &c_b22, &
00470                                 work[j - 1 + *n], n, &wr, &c_b25, x, &c__2, &
00471                                 scale, &xnorm, &ierr);
00472 
00473 /*                    Scale X(1,1) and X(2,1) to avoid overflow when */
00474 /*                    updating the right-hand side. */
00475 
00476                         if (xnorm > 1.) {
00477 /* Computing MAX */
00478                             d__1 = work[j - 1], d__2 = work[j];
00479                             beta = max(d__1,d__2);
00480                             if (beta > bignum / xnorm) {
00481                                 x[0] /= xnorm;
00482                                 x[1] /= xnorm;
00483                                 scale /= xnorm;
00484                             }
00485                         }
00486 
00487 /*                    Scale if necessary */
00488 
00489                         if (scale != 1.) {
00490                             dscal_(&ki, &scale, &work[*n + 1], &c__1);
00491                         }
00492                         work[j - 1 + *n] = x[0];
00493                         work[j + *n] = x[1];
00494 
00495 /*                    Update right-hand side */
00496 
00497                         i__1 = j - 2;
00498                         d__1 = -x[0];
00499                         daxpy_(&i__1, &d__1, &t[(j - 1) * t_dim1 + 1], &c__1, 
00500                                 &work[*n + 1], &c__1);
00501                         i__1 = j - 2;
00502                         d__1 = -x[1];
00503                         daxpy_(&i__1, &d__1, &t[j * t_dim1 + 1], &c__1, &work[
00504                                 *n + 1], &c__1);
00505                     }
00506 L60:
00507                     ;
00508                 }
00509 
00510 /*              Copy the vector x or Q*x to VR and normalize. */
00511 
00512                 if (! over) {
00513                     dcopy_(&ki, &work[*n + 1], &c__1, &vr[is * vr_dim1 + 1], &
00514                             c__1);
00515 
00516                     ii = idamax_(&ki, &vr[is * vr_dim1 + 1], &c__1);
00517                     remax = 1. / (d__1 = vr[ii + is * vr_dim1], abs(d__1));
00518                     dscal_(&ki, &remax, &vr[is * vr_dim1 + 1], &c__1);
00519 
00520                     i__1 = *n;
00521                     for (k = ki + 1; k <= i__1; ++k) {
00522                         vr[k + is * vr_dim1] = 0.;
00523 /* L70: */
00524                     }
00525                 } else {
00526                     if (ki > 1) {
00527                         i__1 = ki - 1;
00528                         dgemv_("N", n, &i__1, &c_b22, &vr[vr_offset], ldvr, &
00529                                 work[*n + 1], &c__1, &work[ki + *n], &vr[ki * 
00530                                 vr_dim1 + 1], &c__1);
00531                     }
00532 
00533                     ii = idamax_(n, &vr[ki * vr_dim1 + 1], &c__1);
00534                     remax = 1. / (d__1 = vr[ii + ki * vr_dim1], abs(d__1));
00535                     dscal_(n, &remax, &vr[ki * vr_dim1 + 1], &c__1);
00536                 }
00537 
00538             } else {
00539 
00540 /*              Complex right eigenvector. */
00541 
00542 /*              Initial solve */
00543 /*                [ (T(KI-1,KI-1) T(KI-1,KI) ) - (WR + I* WI)]*X = 0. */
00544 /*                [ (T(KI,KI-1)   T(KI,KI)   )               ] */
00545 
00546                 if ((d__1 = t[ki - 1 + ki * t_dim1], abs(d__1)) >= (d__2 = t[
00547                         ki + (ki - 1) * t_dim1], abs(d__2))) {
00548                     work[ki - 1 + *n] = 1.;
00549                     work[ki + n2] = wi / t[ki - 1 + ki * t_dim1];
00550                 } else {
00551                     work[ki - 1 + *n] = -wi / t[ki + (ki - 1) * t_dim1];
00552                     work[ki + n2] = 1.;
00553                 }
00554                 work[ki + *n] = 0.;
00555                 work[ki - 1 + n2] = 0.;
00556 
00557 /*              Form right-hand side */
00558 
00559                 i__1 = ki - 2;
00560                 for (k = 1; k <= i__1; ++k) {
00561                     work[k + *n] = -work[ki - 1 + *n] * t[k + (ki - 1) * 
00562                             t_dim1];
00563                     work[k + n2] = -work[ki + n2] * t[k + ki * t_dim1];
00564 /* L80: */
00565                 }
00566 
00567 /*              Solve upper quasi-triangular system: */
00568 /*              (T(1:KI-2,1:KI-2) - (WR+i*WI))*X = SCALE*(WORK+i*WORK2) */
00569 
00570                 jnxt = ki - 2;
00571                 for (j = ki - 2; j >= 1; --j) {
00572                     if (j > jnxt) {
00573                         goto L90;
00574                     }
00575                     j1 = j;
00576                     j2 = j;
00577                     jnxt = j - 1;
00578                     if (j > 1) {
00579                         if (t[j + (j - 1) * t_dim1] != 0.) {
00580                             j1 = j - 1;
00581                             jnxt = j - 2;
00582                         }
00583                     }
00584 
00585                     if (j1 == j2) {
00586 
00587 /*                    1-by-1 diagonal block */
00588 
00589                         dlaln2_(&c_false, &c__1, &c__2, &smin, &c_b22, &t[j + 
00590                                 j * t_dim1], ldt, &c_b22, &c_b22, &work[j + *
00591                                 n], n, &wr, &wi, x, &c__2, &scale, &xnorm, &
00592                                 ierr);
00593 
00594 /*                    Scale X(1,1) and X(1,2) to avoid overflow when */
00595 /*                    updating the right-hand side. */
00596 
00597                         if (xnorm > 1.) {
00598                             if (work[j] > bignum / xnorm) {
00599                                 x[0] /= xnorm;
00600                                 x[2] /= xnorm;
00601                                 scale /= xnorm;
00602                             }
00603                         }
00604 
00605 /*                    Scale if necessary */
00606 
00607                         if (scale != 1.) {
00608                             dscal_(&ki, &scale, &work[*n + 1], &c__1);
00609                             dscal_(&ki, &scale, &work[n2 + 1], &c__1);
00610                         }
00611                         work[j + *n] = x[0];
00612                         work[j + n2] = x[2];
00613 
00614 /*                    Update the right-hand side */
00615 
00616                         i__1 = j - 1;
00617                         d__1 = -x[0];
00618                         daxpy_(&i__1, &d__1, &t[j * t_dim1 + 1], &c__1, &work[
00619                                 *n + 1], &c__1);
00620                         i__1 = j - 1;
00621                         d__1 = -x[2];
00622                         daxpy_(&i__1, &d__1, &t[j * t_dim1 + 1], &c__1, &work[
00623                                 n2 + 1], &c__1);
00624 
00625                     } else {
00626 
00627 /*                    2-by-2 diagonal block */
00628 
00629                         dlaln2_(&c_false, &c__2, &c__2, &smin, &c_b22, &t[j - 
00630                                 1 + (j - 1) * t_dim1], ldt, &c_b22, &c_b22, &
00631                                 work[j - 1 + *n], n, &wr, &wi, x, &c__2, &
00632                                 scale, &xnorm, &ierr);
00633 
00634 /*                    Scale X to avoid overflow when updating */
00635 /*                    the right-hand side. */
00636 
00637                         if (xnorm > 1.) {
00638 /* Computing MAX */
00639                             d__1 = work[j - 1], d__2 = work[j];
00640                             beta = max(d__1,d__2);
00641                             if (beta > bignum / xnorm) {
00642                                 rec = 1. / xnorm;
00643                                 x[0] *= rec;
00644                                 x[2] *= rec;
00645                                 x[1] *= rec;
00646                                 x[3] *= rec;
00647                                 scale *= rec;
00648                             }
00649                         }
00650 
00651 /*                    Scale if necessary */
00652 
00653                         if (scale != 1.) {
00654                             dscal_(&ki, &scale, &work[*n + 1], &c__1);
00655                             dscal_(&ki, &scale, &work[n2 + 1], &c__1);
00656                         }
00657                         work[j - 1 + *n] = x[0];
00658                         work[j + *n] = x[1];
00659                         work[j - 1 + n2] = x[2];
00660                         work[j + n2] = x[3];
00661 
00662 /*                    Update the right-hand side */
00663 
00664                         i__1 = j - 2;
00665                         d__1 = -x[0];
00666                         daxpy_(&i__1, &d__1, &t[(j - 1) * t_dim1 + 1], &c__1, 
00667                                 &work[*n + 1], &c__1);
00668                         i__1 = j - 2;
00669                         d__1 = -x[1];
00670                         daxpy_(&i__1, &d__1, &t[j * t_dim1 + 1], &c__1, &work[
00671                                 *n + 1], &c__1);
00672                         i__1 = j - 2;
00673                         d__1 = -x[2];
00674                         daxpy_(&i__1, &d__1, &t[(j - 1) * t_dim1 + 1], &c__1, 
00675                                 &work[n2 + 1], &c__1);
00676                         i__1 = j - 2;
00677                         d__1 = -x[3];
00678                         daxpy_(&i__1, &d__1, &t[j * t_dim1 + 1], &c__1, &work[
00679                                 n2 + 1], &c__1);
00680                     }
00681 L90:
00682                     ;
00683                 }
00684 
00685 /*              Copy the vector x or Q*x to VR and normalize. */
00686 
00687                 if (! over) {
00688                     dcopy_(&ki, &work[*n + 1], &c__1, &vr[(is - 1) * vr_dim1 
00689                             + 1], &c__1);
00690                     dcopy_(&ki, &work[n2 + 1], &c__1, &vr[is * vr_dim1 + 1], &
00691                             c__1);
00692 
00693                     emax = 0.;
00694                     i__1 = ki;
00695                     for (k = 1; k <= i__1; ++k) {
00696 /* Computing MAX */
00697                         d__3 = emax, d__4 = (d__1 = vr[k + (is - 1) * vr_dim1]
00698                                 , abs(d__1)) + (d__2 = vr[k + is * vr_dim1], 
00699                                 abs(d__2));
00700                         emax = max(d__3,d__4);
00701 /* L100: */
00702                     }
00703 
00704                     remax = 1. / emax;
00705                     dscal_(&ki, &remax, &vr[(is - 1) * vr_dim1 + 1], &c__1);
00706                     dscal_(&ki, &remax, &vr[is * vr_dim1 + 1], &c__1);
00707 
00708                     i__1 = *n;
00709                     for (k = ki + 1; k <= i__1; ++k) {
00710                         vr[k + (is - 1) * vr_dim1] = 0.;
00711                         vr[k + is * vr_dim1] = 0.;
00712 /* L110: */
00713                     }
00714 
00715                 } else {
00716 
00717                     if (ki > 2) {
00718                         i__1 = ki - 2;
00719                         dgemv_("N", n, &i__1, &c_b22, &vr[vr_offset], ldvr, &
00720                                 work[*n + 1], &c__1, &work[ki - 1 + *n], &vr[(
00721                                 ki - 1) * vr_dim1 + 1], &c__1);
00722                         i__1 = ki - 2;
00723                         dgemv_("N", n, &i__1, &c_b22, &vr[vr_offset], ldvr, &
00724                                 work[n2 + 1], &c__1, &work[ki + n2], &vr[ki * 
00725                                 vr_dim1 + 1], &c__1);
00726                     } else {
00727                         dscal_(n, &work[ki - 1 + *n], &vr[(ki - 1) * vr_dim1 
00728                                 + 1], &c__1);
00729                         dscal_(n, &work[ki + n2], &vr[ki * vr_dim1 + 1], &
00730                                 c__1);
00731                     }
00732 
00733                     emax = 0.;
00734                     i__1 = *n;
00735                     for (k = 1; k <= i__1; ++k) {
00736 /* Computing MAX */
00737                         d__3 = emax, d__4 = (d__1 = vr[k + (ki - 1) * vr_dim1]
00738                                 , abs(d__1)) + (d__2 = vr[k + ki * vr_dim1], 
00739                                 abs(d__2));
00740                         emax = max(d__3,d__4);
00741 /* L120: */
00742                     }
00743                     remax = 1. / emax;
00744                     dscal_(n, &remax, &vr[(ki - 1) * vr_dim1 + 1], &c__1);
00745                     dscal_(n, &remax, &vr[ki * vr_dim1 + 1], &c__1);
00746                 }
00747             }
00748 
00749             --is;
00750             if (ip != 0) {
00751                 --is;
00752             }
00753 L130:
00754             if (ip == 1) {
00755                 ip = 0;
00756             }
00757             if (ip == -1) {
00758                 ip = 1;
00759             }
00760 /* L140: */
00761         }
00762     }
00763 
00764     if (leftv) {
00765 
00766 /*        Compute left eigenvectors. */
00767 
00768         ip = 0;
00769         is = 1;
00770         i__1 = *n;
00771         for (ki = 1; ki <= i__1; ++ki) {
00772 
00773             if (ip == -1) {
00774                 goto L250;
00775             }
00776             if (ki == *n) {
00777                 goto L150;
00778             }
00779             if (t[ki + 1 + ki * t_dim1] == 0.) {
00780                 goto L150;
00781             }
00782             ip = 1;
00783 
00784 L150:
00785             if (somev) {
00786                 if (! select[ki]) {
00787                     goto L250;
00788                 }
00789             }
00790 
00791 /*           Compute the KI-th eigenvalue (WR,WI). */
00792 
00793             wr = t[ki + ki * t_dim1];
00794             wi = 0.;
00795             if (ip != 0) {
00796                 wi = sqrt((d__1 = t[ki + (ki + 1) * t_dim1], abs(d__1))) * 
00797                         sqrt((d__2 = t[ki + 1 + ki * t_dim1], abs(d__2)));
00798             }
00799 /* Computing MAX */
00800             d__1 = ulp * (abs(wr) + abs(wi));
00801             smin = max(d__1,smlnum);
00802 
00803             if (ip == 0) {
00804 
00805 /*              Real left eigenvector. */
00806 
00807                 work[ki + *n] = 1.;
00808 
00809 /*              Form right-hand side */
00810 
00811                 i__2 = *n;
00812                 for (k = ki + 1; k <= i__2; ++k) {
00813                     work[k + *n] = -t[ki + k * t_dim1];
00814 /* L160: */
00815                 }
00816 
00817 /*              Solve the quasi-triangular system: */
00818 /*                 (T(KI+1:N,KI+1:N) - WR)'*X = SCALE*WORK */
00819 
00820                 vmax = 1.;
00821                 vcrit = bignum;
00822 
00823                 jnxt = ki + 1;
00824                 i__2 = *n;
00825                 for (j = ki + 1; j <= i__2; ++j) {
00826                     if (j < jnxt) {
00827                         goto L170;
00828                     }
00829                     j1 = j;
00830                     j2 = j;
00831                     jnxt = j + 1;
00832                     if (j < *n) {
00833                         if (t[j + 1 + j * t_dim1] != 0.) {
00834                             j2 = j + 1;
00835                             jnxt = j + 2;
00836                         }
00837                     }
00838 
00839                     if (j1 == j2) {
00840 
00841 /*                    1-by-1 diagonal block */
00842 
00843 /*                    Scale if necessary to avoid overflow when forming */
00844 /*                    the right-hand side. */
00845 
00846                         if (work[j] > vcrit) {
00847                             rec = 1. / vmax;
00848                             i__3 = *n - ki + 1;
00849                             dscal_(&i__3, &rec, &work[ki + *n], &c__1);
00850                             vmax = 1.;
00851                             vcrit = bignum;
00852                         }
00853 
00854                         i__3 = j - ki - 1;
00855                         work[j + *n] -= ddot_(&i__3, &t[ki + 1 + j * t_dim1], 
00856                                 &c__1, &work[ki + 1 + *n], &c__1);
00857 
00858 /*                    Solve (T(J,J)-WR)'*X = WORK */
00859 
00860                         dlaln2_(&c_false, &c__1, &c__1, &smin, &c_b22, &t[j + 
00861                                 j * t_dim1], ldt, &c_b22, &c_b22, &work[j + *
00862                                 n], n, &wr, &c_b25, x, &c__2, &scale, &xnorm, 
00863                                 &ierr);
00864 
00865 /*                    Scale if necessary */
00866 
00867                         if (scale != 1.) {
00868                             i__3 = *n - ki + 1;
00869                             dscal_(&i__3, &scale, &work[ki + *n], &c__1);
00870                         }
00871                         work[j + *n] = x[0];
00872 /* Computing MAX */
00873                         d__2 = (d__1 = work[j + *n], abs(d__1));
00874                         vmax = max(d__2,vmax);
00875                         vcrit = bignum / vmax;
00876 
00877                     } else {
00878 
00879 /*                    2-by-2 diagonal block */
00880 
00881 /*                    Scale if necessary to avoid overflow when forming */
00882 /*                    the right-hand side. */
00883 
00884 /* Computing MAX */
00885                         d__1 = work[j], d__2 = work[j + 1];
00886                         beta = max(d__1,d__2);
00887                         if (beta > vcrit) {
00888                             rec = 1. / vmax;
00889                             i__3 = *n - ki + 1;
00890                             dscal_(&i__3, &rec, &work[ki + *n], &c__1);
00891                             vmax = 1.;
00892                             vcrit = bignum;
00893                         }
00894 
00895                         i__3 = j - ki - 1;
00896                         work[j + *n] -= ddot_(&i__3, &t[ki + 1 + j * t_dim1], 
00897                                 &c__1, &work[ki + 1 + *n], &c__1);
00898 
00899                         i__3 = j - ki - 1;
00900                         work[j + 1 + *n] -= ddot_(&i__3, &t[ki + 1 + (j + 1) *
00901                                  t_dim1], &c__1, &work[ki + 1 + *n], &c__1);
00902 
00903 /*                    Solve */
00904 /*                      [T(J,J)-WR   T(J,J+1)     ]'* X = SCALE*( WORK1 ) */
00905 /*                      [T(J+1,J)    T(J+1,J+1)-WR]             ( WORK2 ) */
00906 
00907                         dlaln2_(&c_true, &c__2, &c__1, &smin, &c_b22, &t[j + 
00908                                 j * t_dim1], ldt, &c_b22, &c_b22, &work[j + *
00909                                 n], n, &wr, &c_b25, x, &c__2, &scale, &xnorm, 
00910                                 &ierr);
00911 
00912 /*                    Scale if necessary */
00913 
00914                         if (scale != 1.) {
00915                             i__3 = *n - ki + 1;
00916                             dscal_(&i__3, &scale, &work[ki + *n], &c__1);
00917                         }
00918                         work[j + *n] = x[0];
00919                         work[j + 1 + *n] = x[1];
00920 
00921 /* Computing MAX */
00922                         d__3 = (d__1 = work[j + *n], abs(d__1)), d__4 = (d__2 
00923                                 = work[j + 1 + *n], abs(d__2)), d__3 = max(
00924                                 d__3,d__4);
00925                         vmax = max(d__3,vmax);
00926                         vcrit = bignum / vmax;
00927 
00928                     }
00929 L170:
00930                     ;
00931                 }
00932 
00933 /*              Copy the vector x or Q*x to VL and normalize. */
00934 
00935                 if (! over) {
00936                     i__2 = *n - ki + 1;
00937                     dcopy_(&i__2, &work[ki + *n], &c__1, &vl[ki + is * 
00938                             vl_dim1], &c__1);
00939 
00940                     i__2 = *n - ki + 1;
00941                     ii = idamax_(&i__2, &vl[ki + is * vl_dim1], &c__1) + ki - 
00942                             1;
00943                     remax = 1. / (d__1 = vl[ii + is * vl_dim1], abs(d__1));
00944                     i__2 = *n - ki + 1;
00945                     dscal_(&i__2, &remax, &vl[ki + is * vl_dim1], &c__1);
00946 
00947                     i__2 = ki - 1;
00948                     for (k = 1; k <= i__2; ++k) {
00949                         vl[k + is * vl_dim1] = 0.;
00950 /* L180: */
00951                     }
00952 
00953                 } else {
00954 
00955                     if (ki < *n) {
00956                         i__2 = *n - ki;
00957                         dgemv_("N", n, &i__2, &c_b22, &vl[(ki + 1) * vl_dim1 
00958                                 + 1], ldvl, &work[ki + 1 + *n], &c__1, &work[
00959                                 ki + *n], &vl[ki * vl_dim1 + 1], &c__1);
00960                     }
00961 
00962                     ii = idamax_(n, &vl[ki * vl_dim1 + 1], &c__1);
00963                     remax = 1. / (d__1 = vl[ii + ki * vl_dim1], abs(d__1));
00964                     dscal_(n, &remax, &vl[ki * vl_dim1 + 1], &c__1);
00965 
00966                 }
00967 
00968             } else {
00969 
00970 /*              Complex left eigenvector. */
00971 
00972 /*               Initial solve: */
00973 /*                 ((T(KI,KI)    T(KI,KI+1) )' - (WR - I* WI))*X = 0. */
00974 /*                 ((T(KI+1,KI) T(KI+1,KI+1))                ) */
00975 
00976                 if ((d__1 = t[ki + (ki + 1) * t_dim1], abs(d__1)) >= (d__2 = 
00977                         t[ki + 1 + ki * t_dim1], abs(d__2))) {
00978                     work[ki + *n] = wi / t[ki + (ki + 1) * t_dim1];
00979                     work[ki + 1 + n2] = 1.;
00980                 } else {
00981                     work[ki + *n] = 1.;
00982                     work[ki + 1 + n2] = -wi / t[ki + 1 + ki * t_dim1];
00983                 }
00984                 work[ki + 1 + *n] = 0.;
00985                 work[ki + n2] = 0.;
00986 
00987 /*              Form right-hand side */
00988 
00989                 i__2 = *n;
00990                 for (k = ki + 2; k <= i__2; ++k) {
00991                     work[k + *n] = -work[ki + *n] * t[ki + k * t_dim1];
00992                     work[k + n2] = -work[ki + 1 + n2] * t[ki + 1 + k * t_dim1]
00993                             ;
00994 /* L190: */
00995                 }
00996 
00997 /*              Solve complex quasi-triangular system: */
00998 /*              ( T(KI+2,N:KI+2,N) - (WR-i*WI) )*X = WORK1+i*WORK2 */
00999 
01000                 vmax = 1.;
01001                 vcrit = bignum;
01002 
01003                 jnxt = ki + 2;
01004                 i__2 = *n;
01005                 for (j = ki + 2; j <= i__2; ++j) {
01006                     if (j < jnxt) {
01007                         goto L200;
01008                     }
01009                     j1 = j;
01010                     j2 = j;
01011                     jnxt = j + 1;
01012                     if (j < *n) {
01013                         if (t[j + 1 + j * t_dim1] != 0.) {
01014                             j2 = j + 1;
01015                             jnxt = j + 2;
01016                         }
01017                     }
01018 
01019                     if (j1 == j2) {
01020 
01021 /*                    1-by-1 diagonal block */
01022 
01023 /*                    Scale if necessary to avoid overflow when */
01024 /*                    forming the right-hand side elements. */
01025 
01026                         if (work[j] > vcrit) {
01027                             rec = 1. / vmax;
01028                             i__3 = *n - ki + 1;
01029                             dscal_(&i__3, &rec, &work[ki + *n], &c__1);
01030                             i__3 = *n - ki + 1;
01031                             dscal_(&i__3, &rec, &work[ki + n2], &c__1);
01032                             vmax = 1.;
01033                             vcrit = bignum;
01034                         }
01035 
01036                         i__3 = j - ki - 2;
01037                         work[j + *n] -= ddot_(&i__3, &t[ki + 2 + j * t_dim1], 
01038                                 &c__1, &work[ki + 2 + *n], &c__1);
01039                         i__3 = j - ki - 2;
01040                         work[j + n2] -= ddot_(&i__3, &t[ki + 2 + j * t_dim1], 
01041                                 &c__1, &work[ki + 2 + n2], &c__1);
01042 
01043 /*                    Solve (T(J,J)-(WR-i*WI))*(X11+i*X12)= WK+I*WK2 */
01044 
01045                         d__1 = -wi;
01046                         dlaln2_(&c_false, &c__1, &c__2, &smin, &c_b22, &t[j + 
01047                                 j * t_dim1], ldt, &c_b22, &c_b22, &work[j + *
01048                                 n], n, &wr, &d__1, x, &c__2, &scale, &xnorm, &
01049                                 ierr);
01050 
01051 /*                    Scale if necessary */
01052 
01053                         if (scale != 1.) {
01054                             i__3 = *n - ki + 1;
01055                             dscal_(&i__3, &scale, &work[ki + *n], &c__1);
01056                             i__3 = *n - ki + 1;
01057                             dscal_(&i__3, &scale, &work[ki + n2], &c__1);
01058                         }
01059                         work[j + *n] = x[0];
01060                         work[j + n2] = x[2];
01061 /* Computing MAX */
01062                         d__3 = (d__1 = work[j + *n], abs(d__1)), d__4 = (d__2 
01063                                 = work[j + n2], abs(d__2)), d__3 = max(d__3,
01064                                 d__4);
01065                         vmax = max(d__3,vmax);
01066                         vcrit = bignum / vmax;
01067 
01068                     } else {
01069 
01070 /*                    2-by-2 diagonal block */
01071 
01072 /*                    Scale if necessary to avoid overflow when forming */
01073 /*                    the right-hand side elements. */
01074 
01075 /* Computing MAX */
01076                         d__1 = work[j], d__2 = work[j + 1];
01077                         beta = max(d__1,d__2);
01078                         if (beta > vcrit) {
01079                             rec = 1. / vmax;
01080                             i__3 = *n - ki + 1;
01081                             dscal_(&i__3, &rec, &work[ki + *n], &c__1);
01082                             i__3 = *n - ki + 1;
01083                             dscal_(&i__3, &rec, &work[ki + n2], &c__1);
01084                             vmax = 1.;
01085                             vcrit = bignum;
01086                         }
01087 
01088                         i__3 = j - ki - 2;
01089                         work[j + *n] -= ddot_(&i__3, &t[ki + 2 + j * t_dim1], 
01090                                 &c__1, &work[ki + 2 + *n], &c__1);
01091 
01092                         i__3 = j - ki - 2;
01093                         work[j + n2] -= ddot_(&i__3, &t[ki + 2 + j * t_dim1], 
01094                                 &c__1, &work[ki + 2 + n2], &c__1);
01095 
01096                         i__3 = j - ki - 2;
01097                         work[j + 1 + *n] -= ddot_(&i__3, &t[ki + 2 + (j + 1) *
01098                                  t_dim1], &c__1, &work[ki + 2 + *n], &c__1);
01099 
01100                         i__3 = j - ki - 2;
01101                         work[j + 1 + n2] -= ddot_(&i__3, &t[ki + 2 + (j + 1) *
01102                                  t_dim1], &c__1, &work[ki + 2 + n2], &c__1);
01103 
01104 /*                    Solve 2-by-2 complex linear equation */
01105 /*                      ([T(j,j)   T(j,j+1)  ]'-(wr-i*wi)*I)*X = SCALE*B */
01106 /*                      ([T(j+1,j) T(j+1,j+1)]             ) */
01107 
01108                         d__1 = -wi;
01109                         dlaln2_(&c_true, &c__2, &c__2, &smin, &c_b22, &t[j + 
01110                                 j * t_dim1], ldt, &c_b22, &c_b22, &work[j + *
01111                                 n], n, &wr, &d__1, x, &c__2, &scale, &xnorm, &
01112                                 ierr);
01113 
01114 /*                    Scale if necessary */
01115 
01116                         if (scale != 1.) {
01117                             i__3 = *n - ki + 1;
01118                             dscal_(&i__3, &scale, &work[ki + *n], &c__1);
01119                             i__3 = *n - ki + 1;
01120                             dscal_(&i__3, &scale, &work[ki + n2], &c__1);
01121                         }
01122                         work[j + *n] = x[0];
01123                         work[j + n2] = x[2];
01124                         work[j + 1 + *n] = x[1];
01125                         work[j + 1 + n2] = x[3];
01126 /* Computing MAX */
01127                         d__1 = abs(x[0]), d__2 = abs(x[2]), d__1 = max(d__1,
01128                                 d__2), d__2 = abs(x[1]), d__1 = max(d__1,d__2)
01129                                 , d__2 = abs(x[3]), d__1 = max(d__1,d__2);
01130                         vmax = max(d__1,vmax);
01131                         vcrit = bignum / vmax;
01132 
01133                     }
01134 L200:
01135                     ;
01136                 }
01137 
01138 /*              Copy the vector x or Q*x to VL and normalize. */
01139 
01140                 if (! over) {
01141                     i__2 = *n - ki + 1;
01142                     dcopy_(&i__2, &work[ki + *n], &c__1, &vl[ki + is * 
01143                             vl_dim1], &c__1);
01144                     i__2 = *n - ki + 1;
01145                     dcopy_(&i__2, &work[ki + n2], &c__1, &vl[ki + (is + 1) * 
01146                             vl_dim1], &c__1);
01147 
01148                     emax = 0.;
01149                     i__2 = *n;
01150                     for (k = ki; k <= i__2; ++k) {
01151 /* Computing MAX */
01152                         d__3 = emax, d__4 = (d__1 = vl[k + is * vl_dim1], abs(
01153                                 d__1)) + (d__2 = vl[k + (is + 1) * vl_dim1], 
01154                                 abs(d__2));
01155                         emax = max(d__3,d__4);
01156 /* L220: */
01157                     }
01158                     remax = 1. / emax;
01159                     i__2 = *n - ki + 1;
01160                     dscal_(&i__2, &remax, &vl[ki + is * vl_dim1], &c__1);
01161                     i__2 = *n - ki + 1;
01162                     dscal_(&i__2, &remax, &vl[ki + (is + 1) * vl_dim1], &c__1)
01163                             ;
01164 
01165                     i__2 = ki - 1;
01166                     for (k = 1; k <= i__2; ++k) {
01167                         vl[k + is * vl_dim1] = 0.;
01168                         vl[k + (is + 1) * vl_dim1] = 0.;
01169 /* L230: */
01170                     }
01171                 } else {
01172                     if (ki < *n - 1) {
01173                         i__2 = *n - ki - 1;
01174                         dgemv_("N", n, &i__2, &c_b22, &vl[(ki + 2) * vl_dim1 
01175                                 + 1], ldvl, &work[ki + 2 + *n], &c__1, &work[
01176                                 ki + *n], &vl[ki * vl_dim1 + 1], &c__1);
01177                         i__2 = *n - ki - 1;
01178                         dgemv_("N", n, &i__2, &c_b22, &vl[(ki + 2) * vl_dim1 
01179                                 + 1], ldvl, &work[ki + 2 + n2], &c__1, &work[
01180                                 ki + 1 + n2], &vl[(ki + 1) * vl_dim1 + 1], &
01181                                 c__1);
01182                     } else {
01183                         dscal_(n, &work[ki + *n], &vl[ki * vl_dim1 + 1], &
01184                                 c__1);
01185                         dscal_(n, &work[ki + 1 + n2], &vl[(ki + 1) * vl_dim1 
01186                                 + 1], &c__1);
01187                     }
01188 
01189                     emax = 0.;
01190                     i__2 = *n;
01191                     for (k = 1; k <= i__2; ++k) {
01192 /* Computing MAX */
01193                         d__3 = emax, d__4 = (d__1 = vl[k + ki * vl_dim1], abs(
01194                                 d__1)) + (d__2 = vl[k + (ki + 1) * vl_dim1], 
01195                                 abs(d__2));
01196                         emax = max(d__3,d__4);
01197 /* L240: */
01198                     }
01199                     remax = 1. / emax;
01200                     dscal_(n, &remax, &vl[ki * vl_dim1 + 1], &c__1);
01201                     dscal_(n, &remax, &vl[(ki + 1) * vl_dim1 + 1], &c__1);
01202 
01203                 }
01204 
01205             }
01206 
01207             ++is;
01208             if (ip != 0) {
01209                 ++is;
01210             }
01211 L250:
01212             if (ip == -1) {
01213                 ip = 0;
01214             }
01215             if (ip == 1) {
01216                 ip = -1;
01217             }
01218 
01219 /* L260: */
01220         }
01221 
01222     }
01223 
01224     return 0;
01225 
01226 /*     End of DTREVC */
01227 
01228 } /* dtrevc_ */


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