zggbal.c
Go to the documentation of this file.
00001 /* zggbal.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 doublereal c_b36 = 10.;
00020 static doublereal c_b72 = .5;
00021 
00022 /* Subroutine */ int zggbal_(char *job, integer *n, doublecomplex *a, integer 
00023         *lda, doublecomplex *b, integer *ldb, integer *ilo, integer *ihi, 
00024         doublereal *lscale, doublereal *rscale, doublereal *work, integer *
00025         info)
00026 {
00027     /* System generated locals */
00028     integer a_dim1, a_offset, b_dim1, b_offset, i__1, i__2, i__3, i__4;
00029     doublereal d__1, d__2, d__3;
00030 
00031     /* Builtin functions */
00032     double d_lg10(doublereal *), d_imag(doublecomplex *), z_abs(doublecomplex 
00033             *), d_sign(doublereal *, doublereal *), pow_di(doublereal *, 
00034             integer *);
00035 
00036     /* Local variables */
00037     integer i__, j, k, l, m;
00038     doublereal t;
00039     integer jc;
00040     doublereal ta, tb, tc;
00041     integer ir;
00042     doublereal ew;
00043     integer it, nr, ip1, jp1, lm1;
00044     doublereal cab, rab, ewc, cor, sum;
00045     integer nrp2, icab, lcab;
00046     doublereal beta, coef;
00047     integer irab, lrab;
00048     doublereal basl, cmax;
00049     extern doublereal ddot_(integer *, doublereal *, integer *, doublereal *, 
00050             integer *);
00051     doublereal coef2, coef5, gamma, alpha;
00052     extern /* Subroutine */ int dscal_(integer *, doublereal *, doublereal *, 
00053             integer *);
00054     extern logical lsame_(char *, char *);
00055     doublereal sfmin, sfmax;
00056     integer iflow;
00057     extern /* Subroutine */ int daxpy_(integer *, doublereal *, doublereal *, 
00058             integer *, doublereal *, integer *);
00059     integer kount;
00060     extern /* Subroutine */ int zswap_(integer *, doublecomplex *, integer *, 
00061             doublecomplex *, integer *);
00062     extern doublereal dlamch_(char *);
00063     doublereal pgamma;
00064     extern /* Subroutine */ int xerbla_(char *, integer *), zdscal_(
00065             integer *, doublereal *, doublecomplex *, integer *);
00066     integer lsfmin;
00067     extern integer izamax_(integer *, doublecomplex *, integer *);
00068     integer lsfmax;
00069 
00070 
00071 /*  -- LAPACK routine (version 3.2) -- */
00072 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00073 /*     November 2006 */
00074 
00075 /*     .. Scalar Arguments .. */
00076 /*     .. */
00077 /*     .. Array Arguments .. */
00078 /*     .. */
00079 
00080 /*  Purpose */
00081 /*  ======= */
00082 
00083 /*  ZGGBAL balances a pair of general complex matrices (A,B).  This */
00084 /*  involves, first, permuting A and B by similarity transformations to */
00085 /*  isolate eigenvalues in the first 1 to ILO$-$1 and last IHI+1 to N */
00086 /*  elements on the diagonal; and second, applying a diagonal similarity */
00087 /*  transformation to rows and columns ILO to IHI to make the rows */
00088 /*  and columns as close in norm as possible. Both steps are optional. */
00089 
00090 /*  Balancing may reduce the 1-norm of the matrices, and improve the */
00091 /*  accuracy of the computed eigenvalues and/or eigenvectors in the */
00092 /*  generalized eigenvalue problem A*x = lambda*B*x. */
00093 
00094 /*  Arguments */
00095 /*  ========= */
00096 
00097 /*  JOB     (input) CHARACTER*1 */
00098 /*          Specifies the operations to be performed on A and B: */
00099 /*          = 'N':  none:  simply set ILO = 1, IHI = N, LSCALE(I) = 1.0 */
00100 /*                  and RSCALE(I) = 1.0 for i=1,...,N; */
00101 /*          = 'P':  permute only; */
00102 /*          = 'S':  scale only; */
00103 /*          = 'B':  both permute and scale. */
00104 
00105 /*  N       (input) INTEGER */
00106 /*          The order of the matrices A and B.  N >= 0. */
00107 
00108 /*  A       (input/output) COMPLEX*16 array, dimension (LDA,N) */
00109 /*          On entry, the input matrix A. */
00110 /*          On exit, A is overwritten by the balanced matrix. */
00111 /*          If JOB = 'N', A is not referenced. */
00112 
00113 /*  LDA     (input) INTEGER */
00114 /*          The leading dimension of the array A. LDA >= max(1,N). */
00115 
00116 /*  B       (input/output) COMPLEX*16 array, dimension (LDB,N) */
00117 /*          On entry, the input matrix B. */
00118 /*          On exit, B is overwritten by the balanced matrix. */
00119 /*          If JOB = 'N', B is not referenced. */
00120 
00121 /*  LDB     (input) INTEGER */
00122 /*          The leading dimension of the array B. LDB >= max(1,N). */
00123 
00124 /*  ILO     (output) INTEGER */
00125 /*  IHI     (output) INTEGER */
00126 /*          ILO and IHI are set to integers such that on exit */
00127 /*          A(i,j) = 0 and B(i,j) = 0 if i > j and */
00128 /*          j = 1,...,ILO-1 or i = IHI+1,...,N. */
00129 /*          If JOB = 'N' or 'S', ILO = 1 and IHI = N. */
00130 
00131 /*  LSCALE  (output) DOUBLE PRECISION array, dimension (N) */
00132 /*          Details of the permutations and scaling factors applied */
00133 /*          to the left side of A and B.  If P(j) is the index of the */
00134 /*          row interchanged with row j, and D(j) is the scaling factor */
00135 /*          applied to row j, then */
00136 /*            LSCALE(j) = P(j)    for J = 1,...,ILO-1 */
00137 /*                      = D(j)    for J = ILO,...,IHI */
00138 /*                      = P(j)    for J = IHI+1,...,N. */
00139 /*          The order in which the interchanges are made is N to IHI+1, */
00140 /*          then 1 to ILO-1. */
00141 
00142 /*  RSCALE  (output) DOUBLE PRECISION array, dimension (N) */
00143 /*          Details of the permutations and scaling factors applied */
00144 /*          to the right side of A and B.  If P(j) is the index of the */
00145 /*          column interchanged with column j, and D(j) is the scaling */
00146 /*          factor applied to column j, then */
00147 /*            RSCALE(j) = P(j)    for J = 1,...,ILO-1 */
00148 /*                      = D(j)    for J = ILO,...,IHI */
00149 /*                      = P(j)    for J = IHI+1,...,N. */
00150 /*          The order in which the interchanges are made is N to IHI+1, */
00151 /*          then 1 to ILO-1. */
00152 
00153 /*  WORK    (workspace) REAL array, dimension (lwork) */
00154 /*          lwork must be at least max(1,6*N) when JOB = 'S' or 'B', and */
00155 /*          at least 1 when JOB = 'N' or 'P'. */
00156 
00157 /*  INFO    (output) INTEGER */
00158 /*          = 0:  successful exit */
00159 /*          < 0:  if INFO = -i, the i-th argument had an illegal value. */
00160 
00161 /*  Further Details */
00162 /*  =============== */
00163 
00164 /*  See R.C. WARD, Balancing the generalized eigenvalue problem, */
00165 /*                 SIAM J. Sci. Stat. Comp. 2 (1981), 141-152. */
00166 
00167 /*  ===================================================================== */
00168 
00169 /*     .. Parameters .. */
00170 /*     .. */
00171 /*     .. Local Scalars .. */
00172 /*     .. */
00173 /*     .. External Functions .. */
00174 /*     .. */
00175 /*     .. External Subroutines .. */
00176 /*     .. */
00177 /*     .. Intrinsic Functions .. */
00178 /*     .. */
00179 /*     .. Statement Functions .. */
00180 /*     .. */
00181 /*     .. Statement Function definitions .. */
00182 /*     .. */
00183 /*     .. Executable Statements .. */
00184 
00185 /*     Test the input parameters */
00186 
00187     /* Parameter adjustments */
00188     a_dim1 = *lda;
00189     a_offset = 1 + a_dim1;
00190     a -= a_offset;
00191     b_dim1 = *ldb;
00192     b_offset = 1 + b_dim1;
00193     b -= b_offset;
00194     --lscale;
00195     --rscale;
00196     --work;
00197 
00198     /* Function Body */
00199     *info = 0;
00200     if (! lsame_(job, "N") && ! lsame_(job, "P") && ! lsame_(job, "S") 
00201             && ! lsame_(job, "B")) {
00202         *info = -1;
00203     } else if (*n < 0) {
00204         *info = -2;
00205     } else if (*lda < max(1,*n)) {
00206         *info = -4;
00207     } else if (*ldb < max(1,*n)) {
00208         *info = -6;
00209     }
00210     if (*info != 0) {
00211         i__1 = -(*info);
00212         xerbla_("ZGGBAL", &i__1);
00213         return 0;
00214     }
00215 
00216 /*     Quick return if possible */
00217 
00218     if (*n == 0) {
00219         *ilo = 1;
00220         *ihi = *n;
00221         return 0;
00222     }
00223 
00224     if (*n == 1) {
00225         *ilo = 1;
00226         *ihi = *n;
00227         lscale[1] = 1.;
00228         rscale[1] = 1.;
00229         return 0;
00230     }
00231 
00232     if (lsame_(job, "N")) {
00233         *ilo = 1;
00234         *ihi = *n;
00235         i__1 = *n;
00236         for (i__ = 1; i__ <= i__1; ++i__) {
00237             lscale[i__] = 1.;
00238             rscale[i__] = 1.;
00239 /* L10: */
00240         }
00241         return 0;
00242     }
00243 
00244     k = 1;
00245     l = *n;
00246     if (lsame_(job, "S")) {
00247         goto L190;
00248     }
00249 
00250     goto L30;
00251 
00252 /*     Permute the matrices A and B to isolate the eigenvalues. */
00253 
00254 /*     Find row with one nonzero in columns 1 through L */
00255 
00256 L20:
00257     l = lm1;
00258     if (l != 1) {
00259         goto L30;
00260     }
00261 
00262     rscale[1] = 1.;
00263     lscale[1] = 1.;
00264     goto L190;
00265 
00266 L30:
00267     lm1 = l - 1;
00268     for (i__ = l; i__ >= 1; --i__) {
00269         i__1 = lm1;
00270         for (j = 1; j <= i__1; ++j) {
00271             jp1 = j + 1;
00272             i__2 = i__ + j * a_dim1;
00273             i__3 = i__ + j * b_dim1;
00274             if (a[i__2].r != 0. || a[i__2].i != 0. || (b[i__3].r != 0. || b[
00275                     i__3].i != 0.)) {
00276                 goto L50;
00277             }
00278 /* L40: */
00279         }
00280         j = l;
00281         goto L70;
00282 
00283 L50:
00284         i__1 = l;
00285         for (j = jp1; j <= i__1; ++j) {
00286             i__2 = i__ + j * a_dim1;
00287             i__3 = i__ + j * b_dim1;
00288             if (a[i__2].r != 0. || a[i__2].i != 0. || (b[i__3].r != 0. || b[
00289                     i__3].i != 0.)) {
00290                 goto L80;
00291             }
00292 /* L60: */
00293         }
00294         j = jp1 - 1;
00295 
00296 L70:
00297         m = l;
00298         iflow = 1;
00299         goto L160;
00300 L80:
00301         ;
00302     }
00303     goto L100;
00304 
00305 /*     Find column with one nonzero in rows K through N */
00306 
00307 L90:
00308     ++k;
00309 
00310 L100:
00311     i__1 = l;
00312     for (j = k; j <= i__1; ++j) {
00313         i__2 = lm1;
00314         for (i__ = k; i__ <= i__2; ++i__) {
00315             ip1 = i__ + 1;
00316             i__3 = i__ + j * a_dim1;
00317             i__4 = i__ + j * b_dim1;
00318             if (a[i__3].r != 0. || a[i__3].i != 0. || (b[i__4].r != 0. || b[
00319                     i__4].i != 0.)) {
00320                 goto L120;
00321             }
00322 /* L110: */
00323         }
00324         i__ = l;
00325         goto L140;
00326 L120:
00327         i__2 = l;
00328         for (i__ = ip1; i__ <= i__2; ++i__) {
00329             i__3 = i__ + j * a_dim1;
00330             i__4 = i__ + j * b_dim1;
00331             if (a[i__3].r != 0. || a[i__3].i != 0. || (b[i__4].r != 0. || b[
00332                     i__4].i != 0.)) {
00333                 goto L150;
00334             }
00335 /* L130: */
00336         }
00337         i__ = ip1 - 1;
00338 L140:
00339         m = k;
00340         iflow = 2;
00341         goto L160;
00342 L150:
00343         ;
00344     }
00345     goto L190;
00346 
00347 /*     Permute rows M and I */
00348 
00349 L160:
00350     lscale[m] = (doublereal) i__;
00351     if (i__ == m) {
00352         goto L170;
00353     }
00354     i__1 = *n - k + 1;
00355     zswap_(&i__1, &a[i__ + k * a_dim1], lda, &a[m + k * a_dim1], lda);
00356     i__1 = *n - k + 1;
00357     zswap_(&i__1, &b[i__ + k * b_dim1], ldb, &b[m + k * b_dim1], ldb);
00358 
00359 /*     Permute columns M and J */
00360 
00361 L170:
00362     rscale[m] = (doublereal) j;
00363     if (j == m) {
00364         goto L180;
00365     }
00366     zswap_(&l, &a[j * a_dim1 + 1], &c__1, &a[m * a_dim1 + 1], &c__1);
00367     zswap_(&l, &b[j * b_dim1 + 1], &c__1, &b[m * b_dim1 + 1], &c__1);
00368 
00369 L180:
00370     switch (iflow) {
00371         case 1:  goto L20;
00372         case 2:  goto L90;
00373     }
00374 
00375 L190:
00376     *ilo = k;
00377     *ihi = l;
00378 
00379     if (lsame_(job, "P")) {
00380         i__1 = *ihi;
00381         for (i__ = *ilo; i__ <= i__1; ++i__) {
00382             lscale[i__] = 1.;
00383             rscale[i__] = 1.;
00384 /* L195: */
00385         }
00386         return 0;
00387     }
00388 
00389     if (*ilo == *ihi) {
00390         return 0;
00391     }
00392 
00393 /*     Balance the submatrix in rows ILO to IHI. */
00394 
00395     nr = *ihi - *ilo + 1;
00396     i__1 = *ihi;
00397     for (i__ = *ilo; i__ <= i__1; ++i__) {
00398         rscale[i__] = 0.;
00399         lscale[i__] = 0.;
00400 
00401         work[i__] = 0.;
00402         work[i__ + *n] = 0.;
00403         work[i__ + (*n << 1)] = 0.;
00404         work[i__ + *n * 3] = 0.;
00405         work[i__ + (*n << 2)] = 0.;
00406         work[i__ + *n * 5] = 0.;
00407 /* L200: */
00408     }
00409 
00410 /*     Compute right side vector in resulting linear equations */
00411 
00412     basl = d_lg10(&c_b36);
00413     i__1 = *ihi;
00414     for (i__ = *ilo; i__ <= i__1; ++i__) {
00415         i__2 = *ihi;
00416         for (j = *ilo; j <= i__2; ++j) {
00417             i__3 = i__ + j * a_dim1;
00418             if (a[i__3].r == 0. && a[i__3].i == 0.) {
00419                 ta = 0.;
00420                 goto L210;
00421             }
00422             i__3 = i__ + j * a_dim1;
00423             d__3 = (d__1 = a[i__3].r, abs(d__1)) + (d__2 = d_imag(&a[i__ + j *
00424                      a_dim1]), abs(d__2));
00425             ta = d_lg10(&d__3) / basl;
00426 
00427 L210:
00428             i__3 = i__ + j * b_dim1;
00429             if (b[i__3].r == 0. && b[i__3].i == 0.) {
00430                 tb = 0.;
00431                 goto L220;
00432             }
00433             i__3 = i__ + j * b_dim1;
00434             d__3 = (d__1 = b[i__3].r, abs(d__1)) + (d__2 = d_imag(&b[i__ + j *
00435                      b_dim1]), abs(d__2));
00436             tb = d_lg10(&d__3) / basl;
00437 
00438 L220:
00439             work[i__ + (*n << 2)] = work[i__ + (*n << 2)] - ta - tb;
00440             work[j + *n * 5] = work[j + *n * 5] - ta - tb;
00441 /* L230: */
00442         }
00443 /* L240: */
00444     }
00445 
00446     coef = 1. / (doublereal) (nr << 1);
00447     coef2 = coef * coef;
00448     coef5 = coef2 * .5;
00449     nrp2 = nr + 2;
00450     beta = 0.;
00451     it = 1;
00452 
00453 /*     Start generalized conjugate gradient iteration */
00454 
00455 L250:
00456 
00457     gamma = ddot_(&nr, &work[*ilo + (*n << 2)], &c__1, &work[*ilo + (*n << 2)]
00458 , &c__1) + ddot_(&nr, &work[*ilo + *n * 5], &c__1, &work[*ilo + *
00459             n * 5], &c__1);
00460 
00461     ew = 0.;
00462     ewc = 0.;
00463     i__1 = *ihi;
00464     for (i__ = *ilo; i__ <= i__1; ++i__) {
00465         ew += work[i__ + (*n << 2)];
00466         ewc += work[i__ + *n * 5];
00467 /* L260: */
00468     }
00469 
00470 /* Computing 2nd power */
00471     d__1 = ew;
00472 /* Computing 2nd power */
00473     d__2 = ewc;
00474 /* Computing 2nd power */
00475     d__3 = ew - ewc;
00476     gamma = coef * gamma - coef2 * (d__1 * d__1 + d__2 * d__2) - coef5 * (
00477             d__3 * d__3);
00478     if (gamma == 0.) {
00479         goto L350;
00480     }
00481     if (it != 1) {
00482         beta = gamma / pgamma;
00483     }
00484     t = coef5 * (ewc - ew * 3.);
00485     tc = coef5 * (ew - ewc * 3.);
00486 
00487     dscal_(&nr, &beta, &work[*ilo], &c__1);
00488     dscal_(&nr, &beta, &work[*ilo + *n], &c__1);
00489 
00490     daxpy_(&nr, &coef, &work[*ilo + (*n << 2)], &c__1, &work[*ilo + *n], &
00491             c__1);
00492     daxpy_(&nr, &coef, &work[*ilo + *n * 5], &c__1, &work[*ilo], &c__1);
00493 
00494     i__1 = *ihi;
00495     for (i__ = *ilo; i__ <= i__1; ++i__) {
00496         work[i__] += tc;
00497         work[i__ + *n] += t;
00498 /* L270: */
00499     }
00500 
00501 /*     Apply matrix to vector */
00502 
00503     i__1 = *ihi;
00504     for (i__ = *ilo; i__ <= i__1; ++i__) {
00505         kount = 0;
00506         sum = 0.;
00507         i__2 = *ihi;
00508         for (j = *ilo; j <= i__2; ++j) {
00509             i__3 = i__ + j * a_dim1;
00510             if (a[i__3].r == 0. && a[i__3].i == 0.) {
00511                 goto L280;
00512             }
00513             ++kount;
00514             sum += work[j];
00515 L280:
00516             i__3 = i__ + j * b_dim1;
00517             if (b[i__3].r == 0. && b[i__3].i == 0.) {
00518                 goto L290;
00519             }
00520             ++kount;
00521             sum += work[j];
00522 L290:
00523             ;
00524         }
00525         work[i__ + (*n << 1)] = (doublereal) kount * work[i__ + *n] + sum;
00526 /* L300: */
00527     }
00528 
00529     i__1 = *ihi;
00530     for (j = *ilo; j <= i__1; ++j) {
00531         kount = 0;
00532         sum = 0.;
00533         i__2 = *ihi;
00534         for (i__ = *ilo; i__ <= i__2; ++i__) {
00535             i__3 = i__ + j * a_dim1;
00536             if (a[i__3].r == 0. && a[i__3].i == 0.) {
00537                 goto L310;
00538             }
00539             ++kount;
00540             sum += work[i__ + *n];
00541 L310:
00542             i__3 = i__ + j * b_dim1;
00543             if (b[i__3].r == 0. && b[i__3].i == 0.) {
00544                 goto L320;
00545             }
00546             ++kount;
00547             sum += work[i__ + *n];
00548 L320:
00549             ;
00550         }
00551         work[j + *n * 3] = (doublereal) kount * work[j] + sum;
00552 /* L330: */
00553     }
00554 
00555     sum = ddot_(&nr, &work[*ilo + *n], &c__1, &work[*ilo + (*n << 1)], &c__1) 
00556             + ddot_(&nr, &work[*ilo], &c__1, &work[*ilo + *n * 3], &c__1);
00557     alpha = gamma / sum;
00558 
00559 /*     Determine correction to current iteration */
00560 
00561     cmax = 0.;
00562     i__1 = *ihi;
00563     for (i__ = *ilo; i__ <= i__1; ++i__) {
00564         cor = alpha * work[i__ + *n];
00565         if (abs(cor) > cmax) {
00566             cmax = abs(cor);
00567         }
00568         lscale[i__] += cor;
00569         cor = alpha * work[i__];
00570         if (abs(cor) > cmax) {
00571             cmax = abs(cor);
00572         }
00573         rscale[i__] += cor;
00574 /* L340: */
00575     }
00576     if (cmax < .5) {
00577         goto L350;
00578     }
00579 
00580     d__1 = -alpha;
00581     daxpy_(&nr, &d__1, &work[*ilo + (*n << 1)], &c__1, &work[*ilo + (*n << 2)]
00582 , &c__1);
00583     d__1 = -alpha;
00584     daxpy_(&nr, &d__1, &work[*ilo + *n * 3], &c__1, &work[*ilo + *n * 5], &
00585             c__1);
00586 
00587     pgamma = gamma;
00588     ++it;
00589     if (it <= nrp2) {
00590         goto L250;
00591     }
00592 
00593 /*     End generalized conjugate gradient iteration */
00594 
00595 L350:
00596     sfmin = dlamch_("S");
00597     sfmax = 1. / sfmin;
00598     lsfmin = (integer) (d_lg10(&sfmin) / basl + 1.);
00599     lsfmax = (integer) (d_lg10(&sfmax) / basl);
00600     i__1 = *ihi;
00601     for (i__ = *ilo; i__ <= i__1; ++i__) {
00602         i__2 = *n - *ilo + 1;
00603         irab = izamax_(&i__2, &a[i__ + *ilo * a_dim1], lda);
00604         rab = z_abs(&a[i__ + (irab + *ilo - 1) * a_dim1]);
00605         i__2 = *n - *ilo + 1;
00606         irab = izamax_(&i__2, &b[i__ + *ilo * b_dim1], ldb);
00607 /* Computing MAX */
00608         d__1 = rab, d__2 = z_abs(&b[i__ + (irab + *ilo - 1) * b_dim1]);
00609         rab = max(d__1,d__2);
00610         d__1 = rab + sfmin;
00611         lrab = (integer) (d_lg10(&d__1) / basl + 1.);
00612         ir = (integer) (lscale[i__] + d_sign(&c_b72, &lscale[i__]));
00613 /* Computing MIN */
00614         i__2 = max(ir,lsfmin), i__2 = min(i__2,lsfmax), i__3 = lsfmax - lrab;
00615         ir = min(i__2,i__3);
00616         lscale[i__] = pow_di(&c_b36, &ir);
00617         icab = izamax_(ihi, &a[i__ * a_dim1 + 1], &c__1);
00618         cab = z_abs(&a[icab + i__ * a_dim1]);
00619         icab = izamax_(ihi, &b[i__ * b_dim1 + 1], &c__1);
00620 /* Computing MAX */
00621         d__1 = cab, d__2 = z_abs(&b[icab + i__ * b_dim1]);
00622         cab = max(d__1,d__2);
00623         d__1 = cab + sfmin;
00624         lcab = (integer) (d_lg10(&d__1) / basl + 1.);
00625         jc = (integer) (rscale[i__] + d_sign(&c_b72, &rscale[i__]));
00626 /* Computing MIN */
00627         i__2 = max(jc,lsfmin), i__2 = min(i__2,lsfmax), i__3 = lsfmax - lcab;
00628         jc = min(i__2,i__3);
00629         rscale[i__] = pow_di(&c_b36, &jc);
00630 /* L360: */
00631     }
00632 
00633 /*     Row scaling of matrices A and B */
00634 
00635     i__1 = *ihi;
00636     for (i__ = *ilo; i__ <= i__1; ++i__) {
00637         i__2 = *n - *ilo + 1;
00638         zdscal_(&i__2, &lscale[i__], &a[i__ + *ilo * a_dim1], lda);
00639         i__2 = *n - *ilo + 1;
00640         zdscal_(&i__2, &lscale[i__], &b[i__ + *ilo * b_dim1], ldb);
00641 /* L370: */
00642     }
00643 
00644 /*     Column scaling of matrices A and B */
00645 
00646     i__1 = *ihi;
00647     for (j = *ilo; j <= i__1; ++j) {
00648         zdscal_(ihi, &rscale[j], &a[j * a_dim1 + 1], &c__1);
00649         zdscal_(ihi, &rscale[j], &b[j * b_dim1 + 1], &c__1);
00650 /* L380: */
00651     }
00652 
00653     return 0;
00654 
00655 /*     End of ZGGBAL */
00656 
00657 } /* zggbal_ */


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