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


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