ssbgst.c
Go to the documentation of this file.
00001 /* ssbgst.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 real c_b8 = 0.f;
00019 static real c_b9 = 1.f;
00020 static integer c__1 = 1;
00021 static real c_b20 = -1.f;
00022 
00023 /* Subroutine */ int ssbgst_(char *vect, char *uplo, integer *n, integer *ka, 
00024         integer *kb, real *ab, integer *ldab, real *bb, integer *ldbb, real *
00025         x, integer *ldx, real *work, integer *info)
00026 {
00027     /* System generated locals */
00028     integer ab_dim1, ab_offset, bb_dim1, bb_offset, x_dim1, x_offset, i__1, 
00029             i__2, i__3, i__4;
00030     real r__1;
00031 
00032     /* Local variables */
00033     integer i__, j, k, l, m;
00034     real t;
00035     integer i0, i1, i2, j1, j2;
00036     real ra;
00037     integer nr, nx, ka1, kb1;
00038     real ra1;
00039     integer j1t, j2t;
00040     real bii;
00041     integer kbt, nrt, inca;
00042     extern /* Subroutine */ int sger_(integer *, integer *, real *, real *, 
00043             integer *, real *, integer *, real *, integer *), srot_(integer *, 
00044              real *, integer *, real *, integer *, real *, real *);
00045     extern logical lsame_(char *, char *);
00046     extern /* Subroutine */ int sscal_(integer *, real *, real *, integer *);
00047     logical upper, wantx;
00048     extern /* Subroutine */ int slar2v_(integer *, real *, real *, real *, 
00049             integer *, real *, real *, integer *), xerbla_(char *, integer *);
00050     logical update;
00051     extern /* Subroutine */ int slaset_(char *, integer *, integer *, real *, 
00052             real *, real *, integer *), slartg_(real *, real *, real *
00053 , real *, real *), slargv_(integer *, real *, integer *, real *, 
00054             integer *, real *, integer *), slartv_(integer *, real *, integer 
00055             *, real *, integer *, real *, real *, integer *);
00056 
00057 
00058 /*  -- LAPACK routine (version 3.2) -- */
00059 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00060 /*     November 2006 */
00061 
00062 /*     .. Scalar Arguments .. */
00063 /*     .. */
00064 /*     .. Array Arguments .. */
00065 /*     .. */
00066 
00067 /*  Purpose */
00068 /*  ======= */
00069 
00070 /*  SSBGST reduces a real symmetric-definite banded generalized */
00071 /*  eigenproblem  A*x = lambda*B*x  to standard form  C*y = lambda*y, */
00072 /*  such that C has the same bandwidth as A. */
00073 
00074 /*  B must have been previously factorized as S**T*S by SPBSTF, using a */
00075 /*  split Cholesky factorization. A is overwritten by C = X**T*A*X, where */
00076 /*  X = S**(-1)*Q and Q is an orthogonal matrix chosen to preserve the */
00077 /*  bandwidth of A. */
00078 
00079 /*  Arguments */
00080 /*  ========= */
00081 
00082 /*  VECT    (input) CHARACTER*1 */
00083 /*          = 'N':  do not form the transformation matrix X; */
00084 /*          = 'V':  form X. */
00085 
00086 /*  UPLO    (input) CHARACTER*1 */
00087 /*          = 'U':  Upper triangle of A is stored; */
00088 /*          = 'L':  Lower triangle of A is stored. */
00089 
00090 /*  N       (input) INTEGER */
00091 /*          The order of the matrices A and B.  N >= 0. */
00092 
00093 /*  KA      (input) INTEGER */
00094 /*          The number of superdiagonals of the matrix A if UPLO = 'U', */
00095 /*          or the number of subdiagonals if UPLO = 'L'.  KA >= 0. */
00096 
00097 /*  KB      (input) INTEGER */
00098 /*          The number of superdiagonals of the matrix B if UPLO = 'U', */
00099 /*          or the number of subdiagonals if UPLO = 'L'.  KA >= KB >= 0. */
00100 
00101 /*  AB      (input/output) REAL array, dimension (LDAB,N) */
00102 /*          On entry, the upper or lower triangle of the symmetric band */
00103 /*          matrix A, stored in the first ka+1 rows of the array.  The */
00104 /*          j-th column of A is stored in the j-th column of the array AB */
00105 /*          as follows: */
00106 /*          if UPLO = 'U', AB(ka+1+i-j,j) = A(i,j) for max(1,j-ka)<=i<=j; */
00107 /*          if UPLO = 'L', AB(1+i-j,j)    = A(i,j) for j<=i<=min(n,j+ka). */
00108 
00109 /*          On exit, the transformed matrix X**T*A*X, stored in the same */
00110 /*          format as A. */
00111 
00112 /*  LDAB    (input) INTEGER */
00113 /*          The leading dimension of the array AB.  LDAB >= KA+1. */
00114 
00115 /*  BB      (input) REAL array, dimension (LDBB,N) */
00116 /*          The banded factor S from the split Cholesky factorization of */
00117 /*          B, as returned by SPBSTF, stored in the first KB+1 rows of */
00118 /*          the array. */
00119 
00120 /*  LDBB    (input) INTEGER */
00121 /*          The leading dimension of the array BB.  LDBB >= KB+1. */
00122 
00123 /*  X       (output) REAL array, dimension (LDX,N) */
00124 /*          If VECT = 'V', the n-by-n matrix X. */
00125 /*          If VECT = 'N', the array X is not referenced. */
00126 
00127 /*  LDX     (input) INTEGER */
00128 /*          The leading dimension of the array X. */
00129 /*          LDX >= max(1,N) if VECT = 'V'; LDX >= 1 otherwise. */
00130 
00131 /*  WORK    (workspace) REAL array, dimension (2*N) */
00132 
00133 /*  INFO    (output) INTEGER */
00134 /*          = 0:  successful exit */
00135 /*          < 0:  if INFO = -i, the i-th argument had an illegal value. */
00136 
00137 /*  ===================================================================== */
00138 
00139 /*     .. Parameters .. */
00140 /*     .. */
00141 /*     .. Local Scalars .. */
00142 /*     .. */
00143 /*     .. External Functions .. */
00144 /*     .. */
00145 /*     .. External Subroutines .. */
00146 /*     .. */
00147 /*     .. Intrinsic Functions .. */
00148 /*     .. */
00149 /*     .. Executable Statements .. */
00150 
00151 /*     Test the input parameters */
00152 
00153     /* Parameter adjustments */
00154     ab_dim1 = *ldab;
00155     ab_offset = 1 + ab_dim1;
00156     ab -= ab_offset;
00157     bb_dim1 = *ldbb;
00158     bb_offset = 1 + bb_dim1;
00159     bb -= bb_offset;
00160     x_dim1 = *ldx;
00161     x_offset = 1 + x_dim1;
00162     x -= x_offset;
00163     --work;
00164 
00165     /* Function Body */
00166     wantx = lsame_(vect, "V");
00167     upper = lsame_(uplo, "U");
00168     ka1 = *ka + 1;
00169     kb1 = *kb + 1;
00170     *info = 0;
00171     if (! wantx && ! lsame_(vect, "N")) {
00172         *info = -1;
00173     } else if (! upper && ! lsame_(uplo, "L")) {
00174         *info = -2;
00175     } else if (*n < 0) {
00176         *info = -3;
00177     } else if (*ka < 0) {
00178         *info = -4;
00179     } else if (*kb < 0 || *kb > *ka) {
00180         *info = -5;
00181     } else if (*ldab < *ka + 1) {
00182         *info = -7;
00183     } else if (*ldbb < *kb + 1) {
00184         *info = -9;
00185     } else if (*ldx < 1 || wantx && *ldx < max(1,*n)) {
00186         *info = -11;
00187     }
00188     if (*info != 0) {
00189         i__1 = -(*info);
00190         xerbla_("SSBGST", &i__1);
00191         return 0;
00192     }
00193 
00194 /*     Quick return if possible */
00195 
00196     if (*n == 0) {
00197         return 0;
00198     }
00199 
00200     inca = *ldab * ka1;
00201 
00202 /*     Initialize X to the unit matrix, if needed */
00203 
00204     if (wantx) {
00205         slaset_("Full", n, n, &c_b8, &c_b9, &x[x_offset], ldx);
00206     }
00207 
00208 /*     Set M to the splitting point m. It must be the same value as is */
00209 /*     used in SPBSTF. The chosen value allows the arrays WORK and RWORK */
00210 /*     to be of dimension (N). */
00211 
00212     m = (*n + *kb) / 2;
00213 
00214 /*     The routine works in two phases, corresponding to the two halves */
00215 /*     of the split Cholesky factorization of B as S**T*S where */
00216 
00217 /*     S = ( U    ) */
00218 /*         ( M  L ) */
00219 
00220 /*     with U upper triangular of order m, and L lower triangular of */
00221 /*     order n-m. S has the same bandwidth as B. */
00222 
00223 /*     S is treated as a product of elementary matrices: */
00224 
00225 /*     S = S(m)*S(m-1)*...*S(2)*S(1)*S(m+1)*S(m+2)*...*S(n-1)*S(n) */
00226 
00227 /*     where S(i) is determined by the i-th row of S. */
00228 
00229 /*     In phase 1, the index i takes the values n, n-1, ... , m+1; */
00230 /*     in phase 2, it takes the values 1, 2, ... , m. */
00231 
00232 /*     For each value of i, the current matrix A is updated by forming */
00233 /*     inv(S(i))**T*A*inv(S(i)). This creates a triangular bulge outside */
00234 /*     the band of A. The bulge is then pushed down toward the bottom of */
00235 /*     A in phase 1, and up toward the top of A in phase 2, by applying */
00236 /*     plane rotations. */
00237 
00238 /*     There are kb*(kb+1)/2 elements in the bulge, but at most 2*kb-1 */
00239 /*     of them are linearly independent, so annihilating a bulge requires */
00240 /*     only 2*kb-1 plane rotations. The rotations are divided into a 1st */
00241 /*     set of kb-1 rotations, and a 2nd set of kb rotations. */
00242 
00243 /*     Wherever possible, rotations are generated and applied in vector */
00244 /*     operations of length NR between the indices J1 and J2 (sometimes */
00245 /*     replaced by modified values NRT, J1T or J2T). */
00246 
00247 /*     The cosines and sines of the rotations are stored in the array */
00248 /*     WORK. The cosines of the 1st set of rotations are stored in */
00249 /*     elements n+2:n+m-kb-1 and the sines of the 1st set in elements */
00250 /*     2:m-kb-1; the cosines of the 2nd set are stored in elements */
00251 /*     n+m-kb+1:2*n and the sines of the second set in elements m-kb+1:n. */
00252 
00253 /*     The bulges are not formed explicitly; nonzero elements outside the */
00254 /*     band are created only when they are required for generating new */
00255 /*     rotations; they are stored in the array WORK, in positions where */
00256 /*     they are later overwritten by the sines of the rotations which */
00257 /*     annihilate them. */
00258 
00259 /*     **************************** Phase 1 ***************************** */
00260 
00261 /*     The logical structure of this phase is: */
00262 
00263 /*     UPDATE = .TRUE. */
00264 /*     DO I = N, M + 1, -1 */
00265 /*        use S(i) to update A and create a new bulge */
00266 /*        apply rotations to push all bulges KA positions downward */
00267 /*     END DO */
00268 /*     UPDATE = .FALSE. */
00269 /*     DO I = M + KA + 1, N - 1 */
00270 /*        apply rotations to push all bulges KA positions downward */
00271 /*     END DO */
00272 
00273 /*     To avoid duplicating code, the two loops are merged. */
00274 
00275     update = TRUE_;
00276     i__ = *n + 1;
00277 L10:
00278     if (update) {
00279         --i__;
00280 /* Computing MIN */
00281         i__1 = *kb, i__2 = i__ - 1;
00282         kbt = min(i__1,i__2);
00283         i0 = i__ - 1;
00284 /* Computing MIN */
00285         i__1 = *n, i__2 = i__ + *ka;
00286         i1 = min(i__1,i__2);
00287         i2 = i__ - kbt + ka1;
00288         if (i__ < m + 1) {
00289             update = FALSE_;
00290             ++i__;
00291             i0 = m;
00292             if (*ka == 0) {
00293                 goto L480;
00294             }
00295             goto L10;
00296         }
00297     } else {
00298         i__ += *ka;
00299         if (i__ > *n - 1) {
00300             goto L480;
00301         }
00302     }
00303 
00304     if (upper) {
00305 
00306 /*        Transform A, working with the upper triangle */
00307 
00308         if (update) {
00309 
00310 /*           Form  inv(S(i))**T * A * inv(S(i)) */
00311 
00312             bii = bb[kb1 + i__ * bb_dim1];
00313             i__1 = i1;
00314             for (j = i__; j <= i__1; ++j) {
00315                 ab[i__ - j + ka1 + j * ab_dim1] /= bii;
00316 /* L20: */
00317             }
00318 /* Computing MAX */
00319             i__1 = 1, i__2 = i__ - *ka;
00320             i__3 = i__;
00321             for (j = max(i__1,i__2); j <= i__3; ++j) {
00322                 ab[j - i__ + ka1 + i__ * ab_dim1] /= bii;
00323 /* L30: */
00324             }
00325             i__3 = i__ - 1;
00326             for (k = i__ - kbt; k <= i__3; ++k) {
00327                 i__1 = k;
00328                 for (j = i__ - kbt; j <= i__1; ++j) {
00329                     ab[j - k + ka1 + k * ab_dim1] = ab[j - k + ka1 + k * 
00330                             ab_dim1] - bb[j - i__ + kb1 + i__ * bb_dim1] * ab[
00331                             k - i__ + ka1 + i__ * ab_dim1] - bb[k - i__ + kb1 
00332                             + i__ * bb_dim1] * ab[j - i__ + ka1 + i__ * 
00333                             ab_dim1] + ab[ka1 + i__ * ab_dim1] * bb[j - i__ + 
00334                             kb1 + i__ * bb_dim1] * bb[k - i__ + kb1 + i__ * 
00335                             bb_dim1];
00336 /* L40: */
00337                 }
00338 /* Computing MAX */
00339                 i__1 = 1, i__2 = i__ - *ka;
00340                 i__4 = i__ - kbt - 1;
00341                 for (j = max(i__1,i__2); j <= i__4; ++j) {
00342                     ab[j - k + ka1 + k * ab_dim1] -= bb[k - i__ + kb1 + i__ * 
00343                             bb_dim1] * ab[j - i__ + ka1 + i__ * ab_dim1];
00344 /* L50: */
00345                 }
00346 /* L60: */
00347             }
00348             i__3 = i1;
00349             for (j = i__; j <= i__3; ++j) {
00350 /* Computing MAX */
00351                 i__4 = j - *ka, i__1 = i__ - kbt;
00352                 i__2 = i__ - 1;
00353                 for (k = max(i__4,i__1); k <= i__2; ++k) {
00354                     ab[k - j + ka1 + j * ab_dim1] -= bb[k - i__ + kb1 + i__ * 
00355                             bb_dim1] * ab[i__ - j + ka1 + j * ab_dim1];
00356 /* L70: */
00357                 }
00358 /* L80: */
00359             }
00360 
00361             if (wantx) {
00362 
00363 /*              post-multiply X by inv(S(i)) */
00364 
00365                 i__3 = *n - m;
00366                 r__1 = 1.f / bii;
00367                 sscal_(&i__3, &r__1, &x[m + 1 + i__ * x_dim1], &c__1);
00368                 if (kbt > 0) {
00369                     i__3 = *n - m;
00370                     sger_(&i__3, &kbt, &c_b20, &x[m + 1 + i__ * x_dim1], &
00371                             c__1, &bb[kb1 - kbt + i__ * bb_dim1], &c__1, &x[m 
00372                             + 1 + (i__ - kbt) * x_dim1], ldx);
00373                 }
00374             }
00375 
00376 /*           store a(i,i1) in RA1 for use in next loop over K */
00377 
00378             ra1 = ab[i__ - i1 + ka1 + i1 * ab_dim1];
00379         }
00380 
00381 /*        Generate and apply vectors of rotations to chase all the */
00382 /*        existing bulges KA positions down toward the bottom of the */
00383 /*        band */
00384 
00385         i__3 = *kb - 1;
00386         for (k = 1; k <= i__3; ++k) {
00387             if (update) {
00388 
00389 /*              Determine the rotations which would annihilate the bulge */
00390 /*              which has in theory just been created */
00391 
00392                 if (i__ - k + *ka < *n && i__ - k > 1) {
00393 
00394 /*                 generate rotation to annihilate a(i,i-k+ka+1) */
00395 
00396                     slartg_(&ab[k + 1 + (i__ - k + *ka) * ab_dim1], &ra1, &
00397                             work[*n + i__ - k + *ka - m], &work[i__ - k + *ka 
00398                             - m], &ra);
00399 
00400 /*                 create nonzero element a(i-k,i-k+ka+1) outside the */
00401 /*                 band and store it in WORK(i-k) */
00402 
00403                     t = -bb[kb1 - k + i__ * bb_dim1] * ra1;
00404                     work[i__ - k] = work[*n + i__ - k + *ka - m] * t - work[
00405                             i__ - k + *ka - m] * ab[(i__ - k + *ka) * ab_dim1 
00406                             + 1];
00407                     ab[(i__ - k + *ka) * ab_dim1 + 1] = work[i__ - k + *ka - 
00408                             m] * t + work[*n + i__ - k + *ka - m] * ab[(i__ - 
00409                             k + *ka) * ab_dim1 + 1];
00410                     ra1 = ra;
00411                 }
00412             }
00413 /* Computing MAX */
00414             i__2 = 1, i__4 = k - i0 + 2;
00415             j2 = i__ - k - 1 + max(i__2,i__4) * ka1;
00416             nr = (*n - j2 + *ka) / ka1;
00417             j1 = j2 + (nr - 1) * ka1;
00418             if (update) {
00419 /* Computing MAX */
00420                 i__2 = j2, i__4 = i__ + (*ka << 1) - k + 1;
00421                 j2t = max(i__2,i__4);
00422             } else {
00423                 j2t = j2;
00424             }
00425             nrt = (*n - j2t + *ka) / ka1;
00426             i__2 = j1;
00427             i__4 = ka1;
00428             for (j = j2t; i__4 < 0 ? j >= i__2 : j <= i__2; j += i__4) {
00429 
00430 /*              create nonzero element a(j-ka,j+1) outside the band */
00431 /*              and store it in WORK(j-m) */
00432 
00433                 work[j - m] *= ab[(j + 1) * ab_dim1 + 1];
00434                 ab[(j + 1) * ab_dim1 + 1] = work[*n + j - m] * ab[(j + 1) * 
00435                         ab_dim1 + 1];
00436 /* L90: */
00437             }
00438 
00439 /*           generate rotations in 1st set to annihilate elements which */
00440 /*           have been created outside the band */
00441 
00442             if (nrt > 0) {
00443                 slargv_(&nrt, &ab[j2t * ab_dim1 + 1], &inca, &work[j2t - m], &
00444                         ka1, &work[*n + j2t - m], &ka1);
00445             }
00446             if (nr > 0) {
00447 
00448 /*              apply rotations in 1st set from the right */
00449 
00450                 i__4 = *ka - 1;
00451                 for (l = 1; l <= i__4; ++l) {
00452                     slartv_(&nr, &ab[ka1 - l + j2 * ab_dim1], &inca, &ab[*ka 
00453                             - l + (j2 + 1) * ab_dim1], &inca, &work[*n + j2 - 
00454                             m], &work[j2 - m], &ka1);
00455 /* L100: */
00456                 }
00457 
00458 /*              apply rotations in 1st set from both sides to diagonal */
00459 /*              blocks */
00460 
00461                 slar2v_(&nr, &ab[ka1 + j2 * ab_dim1], &ab[ka1 + (j2 + 1) * 
00462                         ab_dim1], &ab[*ka + (j2 + 1) * ab_dim1], &inca, &work[
00463                         *n + j2 - m], &work[j2 - m], &ka1);
00464 
00465             }
00466 
00467 /*           start applying rotations in 1st set from the left */
00468 
00469             i__4 = *kb - k + 1;
00470             for (l = *ka - 1; l >= i__4; --l) {
00471                 nrt = (*n - j2 + l) / ka1;
00472                 if (nrt > 0) {
00473                     slartv_(&nrt, &ab[l + (j2 + ka1 - l) * ab_dim1], &inca, &
00474                             ab[l + 1 + (j2 + ka1 - l) * ab_dim1], &inca, &
00475                             work[*n + j2 - m], &work[j2 - m], &ka1);
00476                 }
00477 /* L110: */
00478             }
00479 
00480             if (wantx) {
00481 
00482 /*              post-multiply X by product of rotations in 1st set */
00483 
00484                 i__4 = j1;
00485                 i__2 = ka1;
00486                 for (j = j2; i__2 < 0 ? j >= i__4 : j <= i__4; j += i__2) {
00487                     i__1 = *n - m;
00488                     srot_(&i__1, &x[m + 1 + j * x_dim1], &c__1, &x[m + 1 + (j 
00489                             + 1) * x_dim1], &c__1, &work[*n + j - m], &work[j 
00490                             - m]);
00491 /* L120: */
00492                 }
00493             }
00494 /* L130: */
00495         }
00496 
00497         if (update) {
00498             if (i2 <= *n && kbt > 0) {
00499 
00500 /*              create nonzero element a(i-kbt,i-kbt+ka+1) outside the */
00501 /*              band and store it in WORK(i-kbt) */
00502 
00503                 work[i__ - kbt] = -bb[kb1 - kbt + i__ * bb_dim1] * ra1;
00504             }
00505         }
00506 
00507         for (k = *kb; k >= 1; --k) {
00508             if (update) {
00509 /* Computing MAX */
00510                 i__3 = 2, i__2 = k - i0 + 1;
00511                 j2 = i__ - k - 1 + max(i__3,i__2) * ka1;
00512             } else {
00513 /* Computing MAX */
00514                 i__3 = 1, i__2 = k - i0 + 1;
00515                 j2 = i__ - k - 1 + max(i__3,i__2) * ka1;
00516             }
00517 
00518 /*           finish applying rotations in 2nd set from the left */
00519 
00520             for (l = *kb - k; l >= 1; --l) {
00521                 nrt = (*n - j2 + *ka + l) / ka1;
00522                 if (nrt > 0) {
00523                     slartv_(&nrt, &ab[l + (j2 - l + 1) * ab_dim1], &inca, &ab[
00524                             l + 1 + (j2 - l + 1) * ab_dim1], &inca, &work[*n 
00525                             + j2 - *ka], &work[j2 - *ka], &ka1);
00526                 }
00527 /* L140: */
00528             }
00529             nr = (*n - j2 + *ka) / ka1;
00530             j1 = j2 + (nr - 1) * ka1;
00531             i__3 = j2;
00532             i__2 = -ka1;
00533             for (j = j1; i__2 < 0 ? j >= i__3 : j <= i__3; j += i__2) {
00534                 work[j] = work[j - *ka];
00535                 work[*n + j] = work[*n + j - *ka];
00536 /* L150: */
00537             }
00538             i__2 = j1;
00539             i__3 = ka1;
00540             for (j = j2; i__3 < 0 ? j >= i__2 : j <= i__2; j += i__3) {
00541 
00542 /*              create nonzero element a(j-ka,j+1) outside the band */
00543 /*              and store it in WORK(j) */
00544 
00545                 work[j] *= ab[(j + 1) * ab_dim1 + 1];
00546                 ab[(j + 1) * ab_dim1 + 1] = work[*n + j] * ab[(j + 1) * 
00547                         ab_dim1 + 1];
00548 /* L160: */
00549             }
00550             if (update) {
00551                 if (i__ - k < *n - *ka && k <= kbt) {
00552                     work[i__ - k + *ka] = work[i__ - k];
00553                 }
00554             }
00555 /* L170: */
00556         }
00557 
00558         for (k = *kb; k >= 1; --k) {
00559 /* Computing MAX */
00560             i__3 = 1, i__2 = k - i0 + 1;
00561             j2 = i__ - k - 1 + max(i__3,i__2) * ka1;
00562             nr = (*n - j2 + *ka) / ka1;
00563             j1 = j2 + (nr - 1) * ka1;
00564             if (nr > 0) {
00565 
00566 /*              generate rotations in 2nd set to annihilate elements */
00567 /*              which have been created outside the band */
00568 
00569                 slargv_(&nr, &ab[j2 * ab_dim1 + 1], &inca, &work[j2], &ka1, &
00570                         work[*n + j2], &ka1);
00571 
00572 /*              apply rotations in 2nd set from the right */
00573 
00574                 i__3 = *ka - 1;
00575                 for (l = 1; l <= i__3; ++l) {
00576                     slartv_(&nr, &ab[ka1 - l + j2 * ab_dim1], &inca, &ab[*ka 
00577                             - l + (j2 + 1) * ab_dim1], &inca, &work[*n + j2], 
00578                             &work[j2], &ka1);
00579 /* L180: */
00580                 }
00581 
00582 /*              apply rotations in 2nd set from both sides to diagonal */
00583 /*              blocks */
00584 
00585                 slar2v_(&nr, &ab[ka1 + j2 * ab_dim1], &ab[ka1 + (j2 + 1) * 
00586                         ab_dim1], &ab[*ka + (j2 + 1) * ab_dim1], &inca, &work[
00587                         *n + j2], &work[j2], &ka1);
00588 
00589             }
00590 
00591 /*           start applying rotations in 2nd set from the left */
00592 
00593             i__3 = *kb - k + 1;
00594             for (l = *ka - 1; l >= i__3; --l) {
00595                 nrt = (*n - j2 + l) / ka1;
00596                 if (nrt > 0) {
00597                     slartv_(&nrt, &ab[l + (j2 + ka1 - l) * ab_dim1], &inca, &
00598                             ab[l + 1 + (j2 + ka1 - l) * ab_dim1], &inca, &
00599                             work[*n + j2], &work[j2], &ka1);
00600                 }
00601 /* L190: */
00602             }
00603 
00604             if (wantx) {
00605 
00606 /*              post-multiply X by product of rotations in 2nd set */
00607 
00608                 i__3 = j1;
00609                 i__2 = ka1;
00610                 for (j = j2; i__2 < 0 ? j >= i__3 : j <= i__3; j += i__2) {
00611                     i__4 = *n - m;
00612                     srot_(&i__4, &x[m + 1 + j * x_dim1], &c__1, &x[m + 1 + (j 
00613                             + 1) * x_dim1], &c__1, &work[*n + j], &work[j]);
00614 /* L200: */
00615                 }
00616             }
00617 /* L210: */
00618         }
00619 
00620         i__2 = *kb - 1;
00621         for (k = 1; k <= i__2; ++k) {
00622 /* Computing MAX */
00623             i__3 = 1, i__4 = k - i0 + 2;
00624             j2 = i__ - k - 1 + max(i__3,i__4) * ka1;
00625 
00626 /*           finish applying rotations in 1st set from the left */
00627 
00628             for (l = *kb - k; l >= 1; --l) {
00629                 nrt = (*n - j2 + l) / ka1;
00630                 if (nrt > 0) {
00631                     slartv_(&nrt, &ab[l + (j2 + ka1 - l) * ab_dim1], &inca, &
00632                             ab[l + 1 + (j2 + ka1 - l) * ab_dim1], &inca, &
00633                             work[*n + j2 - m], &work[j2 - m], &ka1);
00634                 }
00635 /* L220: */
00636             }
00637 /* L230: */
00638         }
00639 
00640         if (*kb > 1) {
00641             i__2 = i__ - *kb + (*ka << 1) + 1;
00642             for (j = *n - 1; j >= i__2; --j) {
00643                 work[*n + j - m] = work[*n + j - *ka - m];
00644                 work[j - m] = work[j - *ka - m];
00645 /* L240: */
00646             }
00647         }
00648 
00649     } else {
00650 
00651 /*        Transform A, working with the lower triangle */
00652 
00653         if (update) {
00654 
00655 /*           Form  inv(S(i))**T * A * inv(S(i)) */
00656 
00657             bii = bb[i__ * bb_dim1 + 1];
00658             i__2 = i1;
00659             for (j = i__; j <= i__2; ++j) {
00660                 ab[j - i__ + 1 + i__ * ab_dim1] /= bii;
00661 /* L250: */
00662             }
00663 /* Computing MAX */
00664             i__2 = 1, i__3 = i__ - *ka;
00665             i__4 = i__;
00666             for (j = max(i__2,i__3); j <= i__4; ++j) {
00667                 ab[i__ - j + 1 + j * ab_dim1] /= bii;
00668 /* L260: */
00669             }
00670             i__4 = i__ - 1;
00671             for (k = i__ - kbt; k <= i__4; ++k) {
00672                 i__2 = k;
00673                 for (j = i__ - kbt; j <= i__2; ++j) {
00674                     ab[k - j + 1 + j * ab_dim1] = ab[k - j + 1 + j * ab_dim1] 
00675                             - bb[i__ - j + 1 + j * bb_dim1] * ab[i__ - k + 1 
00676                             + k * ab_dim1] - bb[i__ - k + 1 + k * bb_dim1] * 
00677                             ab[i__ - j + 1 + j * ab_dim1] + ab[i__ * ab_dim1 
00678                             + 1] * bb[i__ - j + 1 + j * bb_dim1] * bb[i__ - k 
00679                             + 1 + k * bb_dim1];
00680 /* L270: */
00681                 }
00682 /* Computing MAX */
00683                 i__2 = 1, i__3 = i__ - *ka;
00684                 i__1 = i__ - kbt - 1;
00685                 for (j = max(i__2,i__3); j <= i__1; ++j) {
00686                     ab[k - j + 1 + j * ab_dim1] -= bb[i__ - k + 1 + k * 
00687                             bb_dim1] * ab[i__ - j + 1 + j * ab_dim1];
00688 /* L280: */
00689                 }
00690 /* L290: */
00691             }
00692             i__4 = i1;
00693             for (j = i__; j <= i__4; ++j) {
00694 /* Computing MAX */
00695                 i__1 = j - *ka, i__2 = i__ - kbt;
00696                 i__3 = i__ - 1;
00697                 for (k = max(i__1,i__2); k <= i__3; ++k) {
00698                     ab[j - k + 1 + k * ab_dim1] -= bb[i__ - k + 1 + k * 
00699                             bb_dim1] * ab[j - i__ + 1 + i__ * ab_dim1];
00700 /* L300: */
00701                 }
00702 /* L310: */
00703             }
00704 
00705             if (wantx) {
00706 
00707 /*              post-multiply X by inv(S(i)) */
00708 
00709                 i__4 = *n - m;
00710                 r__1 = 1.f / bii;
00711                 sscal_(&i__4, &r__1, &x[m + 1 + i__ * x_dim1], &c__1);
00712                 if (kbt > 0) {
00713                     i__4 = *n - m;
00714                     i__3 = *ldbb - 1;
00715                     sger_(&i__4, &kbt, &c_b20, &x[m + 1 + i__ * x_dim1], &
00716                             c__1, &bb[kbt + 1 + (i__ - kbt) * bb_dim1], &i__3, 
00717                              &x[m + 1 + (i__ - kbt) * x_dim1], ldx);
00718                 }
00719             }
00720 
00721 /*           store a(i1,i) in RA1 for use in next loop over K */
00722 
00723             ra1 = ab[i1 - i__ + 1 + i__ * ab_dim1];
00724         }
00725 
00726 /*        Generate and apply vectors of rotations to chase all the */
00727 /*        existing bulges KA positions down toward the bottom of the */
00728 /*        band */
00729 
00730         i__4 = *kb - 1;
00731         for (k = 1; k <= i__4; ++k) {
00732             if (update) {
00733 
00734 /*              Determine the rotations which would annihilate the bulge */
00735 /*              which has in theory just been created */
00736 
00737                 if (i__ - k + *ka < *n && i__ - k > 1) {
00738 
00739 /*                 generate rotation to annihilate a(i-k+ka+1,i) */
00740 
00741                     slartg_(&ab[ka1 - k + i__ * ab_dim1], &ra1, &work[*n + 
00742                             i__ - k + *ka - m], &work[i__ - k + *ka - m], &ra)
00743                             ;
00744 
00745 /*                 create nonzero element a(i-k+ka+1,i-k) outside the */
00746 /*                 band and store it in WORK(i-k) */
00747 
00748                     t = -bb[k + 1 + (i__ - k) * bb_dim1] * ra1;
00749                     work[i__ - k] = work[*n + i__ - k + *ka - m] * t - work[
00750                             i__ - k + *ka - m] * ab[ka1 + (i__ - k) * ab_dim1]
00751                             ;
00752                     ab[ka1 + (i__ - k) * ab_dim1] = work[i__ - k + *ka - m] * 
00753                             t + work[*n + i__ - k + *ka - m] * ab[ka1 + (i__ 
00754                             - k) * ab_dim1];
00755                     ra1 = ra;
00756                 }
00757             }
00758 /* Computing MAX */
00759             i__3 = 1, i__1 = k - i0 + 2;
00760             j2 = i__ - k - 1 + max(i__3,i__1) * ka1;
00761             nr = (*n - j2 + *ka) / ka1;
00762             j1 = j2 + (nr - 1) * ka1;
00763             if (update) {
00764 /* Computing MAX */
00765                 i__3 = j2, i__1 = i__ + (*ka << 1) - k + 1;
00766                 j2t = max(i__3,i__1);
00767             } else {
00768                 j2t = j2;
00769             }
00770             nrt = (*n - j2t + *ka) / ka1;
00771             i__3 = j1;
00772             i__1 = ka1;
00773             for (j = j2t; i__1 < 0 ? j >= i__3 : j <= i__3; j += i__1) {
00774 
00775 /*              create nonzero element a(j+1,j-ka) outside the band */
00776 /*              and store it in WORK(j-m) */
00777 
00778                 work[j - m] *= ab[ka1 + (j - *ka + 1) * ab_dim1];
00779                 ab[ka1 + (j - *ka + 1) * ab_dim1] = work[*n + j - m] * ab[ka1 
00780                         + (j - *ka + 1) * ab_dim1];
00781 /* L320: */
00782             }
00783 
00784 /*           generate rotations in 1st set to annihilate elements which */
00785 /*           have been created outside the band */
00786 
00787             if (nrt > 0) {
00788                 slargv_(&nrt, &ab[ka1 + (j2t - *ka) * ab_dim1], &inca, &work[
00789                         j2t - m], &ka1, &work[*n + j2t - m], &ka1);
00790             }
00791             if (nr > 0) {
00792 
00793 /*              apply rotations in 1st set from the left */
00794 
00795                 i__1 = *ka - 1;
00796                 for (l = 1; l <= i__1; ++l) {
00797                     slartv_(&nr, &ab[l + 1 + (j2 - l) * ab_dim1], &inca, &ab[
00798                             l + 2 + (j2 - l) * ab_dim1], &inca, &work[*n + j2 
00799                             - m], &work[j2 - m], &ka1);
00800 /* L330: */
00801                 }
00802 
00803 /*              apply rotations in 1st set from both sides to diagonal */
00804 /*              blocks */
00805 
00806                 slar2v_(&nr, &ab[j2 * ab_dim1 + 1], &ab[(j2 + 1) * ab_dim1 + 
00807                         1], &ab[j2 * ab_dim1 + 2], &inca, &work[*n + j2 - m], 
00808                         &work[j2 - m], &ka1);
00809 
00810             }
00811 
00812 /*           start applying rotations in 1st set from the right */
00813 
00814             i__1 = *kb - k + 1;
00815             for (l = *ka - 1; l >= i__1; --l) {
00816                 nrt = (*n - j2 + l) / ka1;
00817                 if (nrt > 0) {
00818                     slartv_(&nrt, &ab[ka1 - l + 1 + j2 * ab_dim1], &inca, &ab[
00819                             ka1 - l + (j2 + 1) * ab_dim1], &inca, &work[*n + 
00820                             j2 - m], &work[j2 - m], &ka1);
00821                 }
00822 /* L340: */
00823             }
00824 
00825             if (wantx) {
00826 
00827 /*              post-multiply X by product of rotations in 1st set */
00828 
00829                 i__1 = j1;
00830                 i__3 = ka1;
00831                 for (j = j2; i__3 < 0 ? j >= i__1 : j <= i__1; j += i__3) {
00832                     i__2 = *n - m;
00833                     srot_(&i__2, &x[m + 1 + j * x_dim1], &c__1, &x[m + 1 + (j 
00834                             + 1) * x_dim1], &c__1, &work[*n + j - m], &work[j 
00835                             - m]);
00836 /* L350: */
00837                 }
00838             }
00839 /* L360: */
00840         }
00841 
00842         if (update) {
00843             if (i2 <= *n && kbt > 0) {
00844 
00845 /*              create nonzero element a(i-kbt+ka+1,i-kbt) outside the */
00846 /*              band and store it in WORK(i-kbt) */
00847 
00848                 work[i__ - kbt] = -bb[kbt + 1 + (i__ - kbt) * bb_dim1] * ra1;
00849             }
00850         }
00851 
00852         for (k = *kb; k >= 1; --k) {
00853             if (update) {
00854 /* Computing MAX */
00855                 i__4 = 2, i__3 = k - i0 + 1;
00856                 j2 = i__ - k - 1 + max(i__4,i__3) * ka1;
00857             } else {
00858 /* Computing MAX */
00859                 i__4 = 1, i__3 = k - i0 + 1;
00860                 j2 = i__ - k - 1 + max(i__4,i__3) * ka1;
00861             }
00862 
00863 /*           finish applying rotations in 2nd set from the right */
00864 
00865             for (l = *kb - k; l >= 1; --l) {
00866                 nrt = (*n - j2 + *ka + l) / ka1;
00867                 if (nrt > 0) {
00868                     slartv_(&nrt, &ab[ka1 - l + 1 + (j2 - *ka) * ab_dim1], &
00869                             inca, &ab[ka1 - l + (j2 - *ka + 1) * ab_dim1], &
00870                             inca, &work[*n + j2 - *ka], &work[j2 - *ka], &ka1)
00871                             ;
00872                 }
00873 /* L370: */
00874             }
00875             nr = (*n - j2 + *ka) / ka1;
00876             j1 = j2 + (nr - 1) * ka1;
00877             i__4 = j2;
00878             i__3 = -ka1;
00879             for (j = j1; i__3 < 0 ? j >= i__4 : j <= i__4; j += i__3) {
00880                 work[j] = work[j - *ka];
00881                 work[*n + j] = work[*n + j - *ka];
00882 /* L380: */
00883             }
00884             i__3 = j1;
00885             i__4 = ka1;
00886             for (j = j2; i__4 < 0 ? j >= i__3 : j <= i__3; j += i__4) {
00887 
00888 /*              create nonzero element a(j+1,j-ka) outside the band */
00889 /*              and store it in WORK(j) */
00890 
00891                 work[j] *= ab[ka1 + (j - *ka + 1) * ab_dim1];
00892                 ab[ka1 + (j - *ka + 1) * ab_dim1] = work[*n + j] * ab[ka1 + (
00893                         j - *ka + 1) * ab_dim1];
00894 /* L390: */
00895             }
00896             if (update) {
00897                 if (i__ - k < *n - *ka && k <= kbt) {
00898                     work[i__ - k + *ka] = work[i__ - k];
00899                 }
00900             }
00901 /* L400: */
00902         }
00903 
00904         for (k = *kb; k >= 1; --k) {
00905 /* Computing MAX */
00906             i__4 = 1, i__3 = k - i0 + 1;
00907             j2 = i__ - k - 1 + max(i__4,i__3) * ka1;
00908             nr = (*n - j2 + *ka) / ka1;
00909             j1 = j2 + (nr - 1) * ka1;
00910             if (nr > 0) {
00911 
00912 /*              generate rotations in 2nd set to annihilate elements */
00913 /*              which have been created outside the band */
00914 
00915                 slargv_(&nr, &ab[ka1 + (j2 - *ka) * ab_dim1], &inca, &work[j2]
00916 , &ka1, &work[*n + j2], &ka1);
00917 
00918 /*              apply rotations in 2nd set from the left */
00919 
00920                 i__4 = *ka - 1;
00921                 for (l = 1; l <= i__4; ++l) {
00922                     slartv_(&nr, &ab[l + 1 + (j2 - l) * ab_dim1], &inca, &ab[
00923                             l + 2 + (j2 - l) * ab_dim1], &inca, &work[*n + j2]
00924 , &work[j2], &ka1);
00925 /* L410: */
00926                 }
00927 
00928 /*              apply rotations in 2nd set from both sides to diagonal */
00929 /*              blocks */
00930 
00931                 slar2v_(&nr, &ab[j2 * ab_dim1 + 1], &ab[(j2 + 1) * ab_dim1 + 
00932                         1], &ab[j2 * ab_dim1 + 2], &inca, &work[*n + j2], &
00933                         work[j2], &ka1);
00934 
00935             }
00936 
00937 /*           start applying rotations in 2nd set from the right */
00938 
00939             i__4 = *kb - k + 1;
00940             for (l = *ka - 1; l >= i__4; --l) {
00941                 nrt = (*n - j2 + l) / ka1;
00942                 if (nrt > 0) {
00943                     slartv_(&nrt, &ab[ka1 - l + 1 + j2 * ab_dim1], &inca, &ab[
00944                             ka1 - l + (j2 + 1) * ab_dim1], &inca, &work[*n + 
00945                             j2], &work[j2], &ka1);
00946                 }
00947 /* L420: */
00948             }
00949 
00950             if (wantx) {
00951 
00952 /*              post-multiply X by product of rotations in 2nd set */
00953 
00954                 i__4 = j1;
00955                 i__3 = ka1;
00956                 for (j = j2; i__3 < 0 ? j >= i__4 : j <= i__4; j += i__3) {
00957                     i__1 = *n - m;
00958                     srot_(&i__1, &x[m + 1 + j * x_dim1], &c__1, &x[m + 1 + (j 
00959                             + 1) * x_dim1], &c__1, &work[*n + j], &work[j]);
00960 /* L430: */
00961                 }
00962             }
00963 /* L440: */
00964         }
00965 
00966         i__3 = *kb - 1;
00967         for (k = 1; k <= i__3; ++k) {
00968 /* Computing MAX */
00969             i__4 = 1, i__1 = k - i0 + 2;
00970             j2 = i__ - k - 1 + max(i__4,i__1) * ka1;
00971 
00972 /*           finish applying rotations in 1st set from the right */
00973 
00974             for (l = *kb - k; l >= 1; --l) {
00975                 nrt = (*n - j2 + l) / ka1;
00976                 if (nrt > 0) {
00977                     slartv_(&nrt, &ab[ka1 - l + 1 + j2 * ab_dim1], &inca, &ab[
00978                             ka1 - l + (j2 + 1) * ab_dim1], &inca, &work[*n + 
00979                             j2 - m], &work[j2 - m], &ka1);
00980                 }
00981 /* L450: */
00982             }
00983 /* L460: */
00984         }
00985 
00986         if (*kb > 1) {
00987             i__3 = i__ - *kb + (*ka << 1) + 1;
00988             for (j = *n - 1; j >= i__3; --j) {
00989                 work[*n + j - m] = work[*n + j - *ka - m];
00990                 work[j - m] = work[j - *ka - m];
00991 /* L470: */
00992             }
00993         }
00994 
00995     }
00996 
00997     goto L10;
00998 
00999 L480:
01000 
01001 /*     **************************** Phase 2 ***************************** */
01002 
01003 /*     The logical structure of this phase is: */
01004 
01005 /*     UPDATE = .TRUE. */
01006 /*     DO I = 1, M */
01007 /*        use S(i) to update A and create a new bulge */
01008 /*        apply rotations to push all bulges KA positions upward */
01009 /*     END DO */
01010 /*     UPDATE = .FALSE. */
01011 /*     DO I = M - KA - 1, 2, -1 */
01012 /*        apply rotations to push all bulges KA positions upward */
01013 /*     END DO */
01014 
01015 /*     To avoid duplicating code, the two loops are merged. */
01016 
01017     update = TRUE_;
01018     i__ = 0;
01019 L490:
01020     if (update) {
01021         ++i__;
01022 /* Computing MIN */
01023         i__3 = *kb, i__4 = m - i__;
01024         kbt = min(i__3,i__4);
01025         i0 = i__ + 1;
01026 /* Computing MAX */
01027         i__3 = 1, i__4 = i__ - *ka;
01028         i1 = max(i__3,i__4);
01029         i2 = i__ + kbt - ka1;
01030         if (i__ > m) {
01031             update = FALSE_;
01032             --i__;
01033             i0 = m + 1;
01034             if (*ka == 0) {
01035                 return 0;
01036             }
01037             goto L490;
01038         }
01039     } else {
01040         i__ -= *ka;
01041         if (i__ < 2) {
01042             return 0;
01043         }
01044     }
01045 
01046     if (i__ < m - kbt) {
01047         nx = m;
01048     } else {
01049         nx = *n;
01050     }
01051 
01052     if (upper) {
01053 
01054 /*        Transform A, working with the upper triangle */
01055 
01056         if (update) {
01057 
01058 /*           Form  inv(S(i))**T * A * inv(S(i)) */
01059 
01060             bii = bb[kb1 + i__ * bb_dim1];
01061             i__3 = i__;
01062             for (j = i1; j <= i__3; ++j) {
01063                 ab[j - i__ + ka1 + i__ * ab_dim1] /= bii;
01064 /* L500: */
01065             }
01066 /* Computing MIN */
01067             i__4 = *n, i__1 = i__ + *ka;
01068             i__3 = min(i__4,i__1);
01069             for (j = i__; j <= i__3; ++j) {
01070                 ab[i__ - j + ka1 + j * ab_dim1] /= bii;
01071 /* L510: */
01072             }
01073             i__3 = i__ + kbt;
01074             for (k = i__ + 1; k <= i__3; ++k) {
01075                 i__4 = i__ + kbt;
01076                 for (j = k; j <= i__4; ++j) {
01077                     ab[k - j + ka1 + j * ab_dim1] = ab[k - j + ka1 + j * 
01078                             ab_dim1] - bb[i__ - j + kb1 + j * bb_dim1] * ab[
01079                             i__ - k + ka1 + k * ab_dim1] - bb[i__ - k + kb1 + 
01080                             k * bb_dim1] * ab[i__ - j + ka1 + j * ab_dim1] + 
01081                             ab[ka1 + i__ * ab_dim1] * bb[i__ - j + kb1 + j * 
01082                             bb_dim1] * bb[i__ - k + kb1 + k * bb_dim1];
01083 /* L520: */
01084                 }
01085 /* Computing MIN */
01086                 i__1 = *n, i__2 = i__ + *ka;
01087                 i__4 = min(i__1,i__2);
01088                 for (j = i__ + kbt + 1; j <= i__4; ++j) {
01089                     ab[k - j + ka1 + j * ab_dim1] -= bb[i__ - k + kb1 + k * 
01090                             bb_dim1] * ab[i__ - j + ka1 + j * ab_dim1];
01091 /* L530: */
01092                 }
01093 /* L540: */
01094             }
01095             i__3 = i__;
01096             for (j = i1; j <= i__3; ++j) {
01097 /* Computing MIN */
01098                 i__1 = j + *ka, i__2 = i__ + kbt;
01099                 i__4 = min(i__1,i__2);
01100                 for (k = i__ + 1; k <= i__4; ++k) {
01101                     ab[j - k + ka1 + k * ab_dim1] -= bb[i__ - k + kb1 + k * 
01102                             bb_dim1] * ab[j - i__ + ka1 + i__ * ab_dim1];
01103 /* L550: */
01104                 }
01105 /* L560: */
01106             }
01107 
01108             if (wantx) {
01109 
01110 /*              post-multiply X by inv(S(i)) */
01111 
01112                 r__1 = 1.f / bii;
01113                 sscal_(&nx, &r__1, &x[i__ * x_dim1 + 1], &c__1);
01114                 if (kbt > 0) {
01115                     i__3 = *ldbb - 1;
01116                     sger_(&nx, &kbt, &c_b20, &x[i__ * x_dim1 + 1], &c__1, &bb[
01117                             *kb + (i__ + 1) * bb_dim1], &i__3, &x[(i__ + 1) * 
01118                             x_dim1 + 1], ldx);
01119                 }
01120             }
01121 
01122 /*           store a(i1,i) in RA1 for use in next loop over K */
01123 
01124             ra1 = ab[i1 - i__ + ka1 + i__ * ab_dim1];
01125         }
01126 
01127 /*        Generate and apply vectors of rotations to chase all the */
01128 /*        existing bulges KA positions up toward the top of the band */
01129 
01130         i__3 = *kb - 1;
01131         for (k = 1; k <= i__3; ++k) {
01132             if (update) {
01133 
01134 /*              Determine the rotations which would annihilate the bulge */
01135 /*              which has in theory just been created */
01136 
01137                 if (i__ + k - ka1 > 0 && i__ + k < m) {
01138 
01139 /*                 generate rotation to annihilate a(i+k-ka-1,i) */
01140 
01141                     slartg_(&ab[k + 1 + i__ * ab_dim1], &ra1, &work[*n + i__ 
01142                             + k - *ka], &work[i__ + k - *ka], &ra);
01143 
01144 /*                 create nonzero element a(i+k-ka-1,i+k) outside the */
01145 /*                 band and store it in WORK(m-kb+i+k) */
01146 
01147                     t = -bb[kb1 - k + (i__ + k) * bb_dim1] * ra1;
01148                     work[m - *kb + i__ + k] = work[*n + i__ + k - *ka] * t - 
01149                             work[i__ + k - *ka] * ab[(i__ + k) * ab_dim1 + 1];
01150                     ab[(i__ + k) * ab_dim1 + 1] = work[i__ + k - *ka] * t + 
01151                             work[*n + i__ + k - *ka] * ab[(i__ + k) * ab_dim1 
01152                             + 1];
01153                     ra1 = ra;
01154                 }
01155             }
01156 /* Computing MAX */
01157             i__4 = 1, i__1 = k + i0 - m + 1;
01158             j2 = i__ + k + 1 - max(i__4,i__1) * ka1;
01159             nr = (j2 + *ka - 1) / ka1;
01160             j1 = j2 - (nr - 1) * ka1;
01161             if (update) {
01162 /* Computing MIN */
01163                 i__4 = j2, i__1 = i__ - (*ka << 1) + k - 1;
01164                 j2t = min(i__4,i__1);
01165             } else {
01166                 j2t = j2;
01167             }
01168             nrt = (j2t + *ka - 1) / ka1;
01169             i__4 = j2t;
01170             i__1 = ka1;
01171             for (j = j1; i__1 < 0 ? j >= i__4 : j <= i__4; j += i__1) {
01172 
01173 /*              create nonzero element a(j-1,j+ka) outside the band */
01174 /*              and store it in WORK(j) */
01175 
01176                 work[j] *= ab[(j + *ka - 1) * ab_dim1 + 1];
01177                 ab[(j + *ka - 1) * ab_dim1 + 1] = work[*n + j] * ab[(j + *ka 
01178                         - 1) * ab_dim1 + 1];
01179 /* L570: */
01180             }
01181 
01182 /*           generate rotations in 1st set to annihilate elements which */
01183 /*           have been created outside the band */
01184 
01185             if (nrt > 0) {
01186                 slargv_(&nrt, &ab[(j1 + *ka) * ab_dim1 + 1], &inca, &work[j1], 
01187                          &ka1, &work[*n + j1], &ka1);
01188             }
01189             if (nr > 0) {
01190 
01191 /*              apply rotations in 1st set from the left */
01192 
01193                 i__1 = *ka - 1;
01194                 for (l = 1; l <= i__1; ++l) {
01195                     slartv_(&nr, &ab[ka1 - l + (j1 + l) * ab_dim1], &inca, &
01196                             ab[*ka - l + (j1 + l) * ab_dim1], &inca, &work[*n 
01197                             + j1], &work[j1], &ka1);
01198 /* L580: */
01199                 }
01200 
01201 /*              apply rotations in 1st set from both sides to diagonal */
01202 /*              blocks */
01203 
01204                 slar2v_(&nr, &ab[ka1 + j1 * ab_dim1], &ab[ka1 + (j1 - 1) * 
01205                         ab_dim1], &ab[*ka + j1 * ab_dim1], &inca, &work[*n + 
01206                         j1], &work[j1], &ka1);
01207 
01208             }
01209 
01210 /*           start applying rotations in 1st set from the right */
01211 
01212             i__1 = *kb - k + 1;
01213             for (l = *ka - 1; l >= i__1; --l) {
01214                 nrt = (j2 + l - 1) / ka1;
01215                 j1t = j2 - (nrt - 1) * ka1;
01216                 if (nrt > 0) {
01217                     slartv_(&nrt, &ab[l + j1t * ab_dim1], &inca, &ab[l + 1 + (
01218                             j1t - 1) * ab_dim1], &inca, &work[*n + j1t], &
01219                             work[j1t], &ka1);
01220                 }
01221 /* L590: */
01222             }
01223 
01224             if (wantx) {
01225 
01226 /*              post-multiply X by product of rotations in 1st set */
01227 
01228                 i__1 = j2;
01229                 i__4 = ka1;
01230                 for (j = j1; i__4 < 0 ? j >= i__1 : j <= i__1; j += i__4) {
01231                     srot_(&nx, &x[j * x_dim1 + 1], &c__1, &x[(j - 1) * x_dim1 
01232                             + 1], &c__1, &work[*n + j], &work[j]);
01233 /* L600: */
01234                 }
01235             }
01236 /* L610: */
01237         }
01238 
01239         if (update) {
01240             if (i2 > 0 && kbt > 0) {
01241 
01242 /*              create nonzero element a(i+kbt-ka-1,i+kbt) outside the */
01243 /*              band and store it in WORK(m-kb+i+kbt) */
01244 
01245                 work[m - *kb + i__ + kbt] = -bb[kb1 - kbt + (i__ + kbt) * 
01246                         bb_dim1] * ra1;
01247             }
01248         }
01249 
01250         for (k = *kb; k >= 1; --k) {
01251             if (update) {
01252 /* Computing MAX */
01253                 i__3 = 2, i__4 = k + i0 - m;
01254                 j2 = i__ + k + 1 - max(i__3,i__4) * ka1;
01255             } else {
01256 /* Computing MAX */
01257                 i__3 = 1, i__4 = k + i0 - m;
01258                 j2 = i__ + k + 1 - max(i__3,i__4) * ka1;
01259             }
01260 
01261 /*           finish applying rotations in 2nd set from the right */
01262 
01263             for (l = *kb - k; l >= 1; --l) {
01264                 nrt = (j2 + *ka + l - 1) / ka1;
01265                 j1t = j2 - (nrt - 1) * ka1;
01266                 if (nrt > 0) {
01267                     slartv_(&nrt, &ab[l + (j1t + *ka) * ab_dim1], &inca, &ab[
01268                             l + 1 + (j1t + *ka - 1) * ab_dim1], &inca, &work[*
01269                             n + m - *kb + j1t + *ka], &work[m - *kb + j1t + *
01270                             ka], &ka1);
01271                 }
01272 /* L620: */
01273             }
01274             nr = (j2 + *ka - 1) / ka1;
01275             j1 = j2 - (nr - 1) * ka1;
01276             i__3 = j2;
01277             i__4 = ka1;
01278             for (j = j1; i__4 < 0 ? j >= i__3 : j <= i__3; j += i__4) {
01279                 work[m - *kb + j] = work[m - *kb + j + *ka];
01280                 work[*n + m - *kb + j] = work[*n + m - *kb + j + *ka];
01281 /* L630: */
01282             }
01283             i__4 = j2;
01284             i__3 = ka1;
01285             for (j = j1; i__3 < 0 ? j >= i__4 : j <= i__4; j += i__3) {
01286 
01287 /*              create nonzero element a(j-1,j+ka) outside the band */
01288 /*              and store it in WORK(m-kb+j) */
01289 
01290                 work[m - *kb + j] *= ab[(j + *ka - 1) * ab_dim1 + 1];
01291                 ab[(j + *ka - 1) * ab_dim1 + 1] = work[*n + m - *kb + j] * ab[
01292                         (j + *ka - 1) * ab_dim1 + 1];
01293 /* L640: */
01294             }
01295             if (update) {
01296                 if (i__ + k > ka1 && k <= kbt) {
01297                     work[m - *kb + i__ + k - *ka] = work[m - *kb + i__ + k];
01298                 }
01299             }
01300 /* L650: */
01301         }
01302 
01303         for (k = *kb; k >= 1; --k) {
01304 /* Computing MAX */
01305             i__3 = 1, i__4 = k + i0 - m;
01306             j2 = i__ + k + 1 - max(i__3,i__4) * ka1;
01307             nr = (j2 + *ka - 1) / ka1;
01308             j1 = j2 - (nr - 1) * ka1;
01309             if (nr > 0) {
01310 
01311 /*              generate rotations in 2nd set to annihilate elements */
01312 /*              which have been created outside the band */
01313 
01314                 slargv_(&nr, &ab[(j1 + *ka) * ab_dim1 + 1], &inca, &work[m - *
01315                         kb + j1], &ka1, &work[*n + m - *kb + j1], &ka1);
01316 
01317 /*              apply rotations in 2nd set from the left */
01318 
01319                 i__3 = *ka - 1;
01320                 for (l = 1; l <= i__3; ++l) {
01321                     slartv_(&nr, &ab[ka1 - l + (j1 + l) * ab_dim1], &inca, &
01322                             ab[*ka - l + (j1 + l) * ab_dim1], &inca, &work[*n 
01323                             + m - *kb + j1], &work[m - *kb + j1], &ka1);
01324 /* L660: */
01325                 }
01326 
01327 /*              apply rotations in 2nd set from both sides to diagonal */
01328 /*              blocks */
01329 
01330                 slar2v_(&nr, &ab[ka1 + j1 * ab_dim1], &ab[ka1 + (j1 - 1) * 
01331                         ab_dim1], &ab[*ka + j1 * ab_dim1], &inca, &work[*n + 
01332                         m - *kb + j1], &work[m - *kb + j1], &ka1);
01333 
01334             }
01335 
01336 /*           start applying rotations in 2nd set from the right */
01337 
01338             i__3 = *kb - k + 1;
01339             for (l = *ka - 1; l >= i__3; --l) {
01340                 nrt = (j2 + l - 1) / ka1;
01341                 j1t = j2 - (nrt - 1) * ka1;
01342                 if (nrt > 0) {
01343                     slartv_(&nrt, &ab[l + j1t * ab_dim1], &inca, &ab[l + 1 + (
01344                             j1t - 1) * ab_dim1], &inca, &work[*n + m - *kb + 
01345                             j1t], &work[m - *kb + j1t], &ka1);
01346                 }
01347 /* L670: */
01348             }
01349 
01350             if (wantx) {
01351 
01352 /*              post-multiply X by product of rotations in 2nd set */
01353 
01354                 i__3 = j2;
01355                 i__4 = ka1;
01356                 for (j = j1; i__4 < 0 ? j >= i__3 : j <= i__3; j += i__4) {
01357                     srot_(&nx, &x[j * x_dim1 + 1], &c__1, &x[(j - 1) * x_dim1 
01358                             + 1], &c__1, &work[*n + m - *kb + j], &work[m - *
01359                             kb + j]);
01360 /* L680: */
01361                 }
01362             }
01363 /* L690: */
01364         }
01365 
01366         i__4 = *kb - 1;
01367         for (k = 1; k <= i__4; ++k) {
01368 /* Computing MAX */
01369             i__3 = 1, i__1 = k + i0 - m + 1;
01370             j2 = i__ + k + 1 - max(i__3,i__1) * ka1;
01371 
01372 /*           finish applying rotations in 1st set from the right */
01373 
01374             for (l = *kb - k; l >= 1; --l) {
01375                 nrt = (j2 + l - 1) / ka1;
01376                 j1t = j2 - (nrt - 1) * ka1;
01377                 if (nrt > 0) {
01378                     slartv_(&nrt, &ab[l + j1t * ab_dim1], &inca, &ab[l + 1 + (
01379                             j1t - 1) * ab_dim1], &inca, &work[*n + j1t], &
01380                             work[j1t], &ka1);
01381                 }
01382 /* L700: */
01383             }
01384 /* L710: */
01385         }
01386 
01387         if (*kb > 1) {
01388 /* Computing MIN */
01389             i__3 = i__ + *kb;
01390             i__4 = min(i__3,m) - (*ka << 1) - 1;
01391             for (j = 2; j <= i__4; ++j) {
01392                 work[*n + j] = work[*n + j + *ka];
01393                 work[j] = work[j + *ka];
01394 /* L720: */
01395             }
01396         }
01397 
01398     } else {
01399 
01400 /*        Transform A, working with the lower triangle */
01401 
01402         if (update) {
01403 
01404 /*           Form  inv(S(i))**T * A * inv(S(i)) */
01405 
01406             bii = bb[i__ * bb_dim1 + 1];
01407             i__4 = i__;
01408             for (j = i1; j <= i__4; ++j) {
01409                 ab[i__ - j + 1 + j * ab_dim1] /= bii;
01410 /* L730: */
01411             }
01412 /* Computing MIN */
01413             i__3 = *n, i__1 = i__ + *ka;
01414             i__4 = min(i__3,i__1);
01415             for (j = i__; j <= i__4; ++j) {
01416                 ab[j - i__ + 1 + i__ * ab_dim1] /= bii;
01417 /* L740: */
01418             }
01419             i__4 = i__ + kbt;
01420             for (k = i__ + 1; k <= i__4; ++k) {
01421                 i__3 = i__ + kbt;
01422                 for (j = k; j <= i__3; ++j) {
01423                     ab[j - k + 1 + k * ab_dim1] = ab[j - k + 1 + k * ab_dim1] 
01424                             - bb[j - i__ + 1 + i__ * bb_dim1] * ab[k - i__ + 
01425                             1 + i__ * ab_dim1] - bb[k - i__ + 1 + i__ * 
01426                             bb_dim1] * ab[j - i__ + 1 + i__ * ab_dim1] + ab[
01427                             i__ * ab_dim1 + 1] * bb[j - i__ + 1 + i__ * 
01428                             bb_dim1] * bb[k - i__ + 1 + i__ * bb_dim1];
01429 /* L750: */
01430                 }
01431 /* Computing MIN */
01432                 i__1 = *n, i__2 = i__ + *ka;
01433                 i__3 = min(i__1,i__2);
01434                 for (j = i__ + kbt + 1; j <= i__3; ++j) {
01435                     ab[j - k + 1 + k * ab_dim1] -= bb[k - i__ + 1 + i__ * 
01436                             bb_dim1] * ab[j - i__ + 1 + i__ * ab_dim1];
01437 /* L760: */
01438                 }
01439 /* L770: */
01440             }
01441             i__4 = i__;
01442             for (j = i1; j <= i__4; ++j) {
01443 /* Computing MIN */
01444                 i__1 = j + *ka, i__2 = i__ + kbt;
01445                 i__3 = min(i__1,i__2);
01446                 for (k = i__ + 1; k <= i__3; ++k) {
01447                     ab[k - j + 1 + j * ab_dim1] -= bb[k - i__ + 1 + i__ * 
01448                             bb_dim1] * ab[i__ - j + 1 + j * ab_dim1];
01449 /* L780: */
01450                 }
01451 /* L790: */
01452             }
01453 
01454             if (wantx) {
01455 
01456 /*              post-multiply X by inv(S(i)) */
01457 
01458                 r__1 = 1.f / bii;
01459                 sscal_(&nx, &r__1, &x[i__ * x_dim1 + 1], &c__1);
01460                 if (kbt > 0) {
01461                     sger_(&nx, &kbt, &c_b20, &x[i__ * x_dim1 + 1], &c__1, &bb[
01462                             i__ * bb_dim1 + 2], &c__1, &x[(i__ + 1) * x_dim1 
01463                             + 1], ldx);
01464                 }
01465             }
01466 
01467 /*           store a(i,i1) in RA1 for use in next loop over K */
01468 
01469             ra1 = ab[i__ - i1 + 1 + i1 * ab_dim1];
01470         }
01471 
01472 /*        Generate and apply vectors of rotations to chase all the */
01473 /*        existing bulges KA positions up toward the top of the band */
01474 
01475         i__4 = *kb - 1;
01476         for (k = 1; k <= i__4; ++k) {
01477             if (update) {
01478 
01479 /*              Determine the rotations which would annihilate the bulge */
01480 /*              which has in theory just been created */
01481 
01482                 if (i__ + k - ka1 > 0 && i__ + k < m) {
01483 
01484 /*                 generate rotation to annihilate a(i,i+k-ka-1) */
01485 
01486                     slartg_(&ab[ka1 - k + (i__ + k - *ka) * ab_dim1], &ra1, &
01487                             work[*n + i__ + k - *ka], &work[i__ + k - *ka], &
01488                             ra);
01489 
01490 /*                 create nonzero element a(i+k,i+k-ka-1) outside the */
01491 /*                 band and store it in WORK(m-kb+i+k) */
01492 
01493                     t = -bb[k + 1 + i__ * bb_dim1] * ra1;
01494                     work[m - *kb + i__ + k] = work[*n + i__ + k - *ka] * t - 
01495                             work[i__ + k - *ka] * ab[ka1 + (i__ + k - *ka) * 
01496                             ab_dim1];
01497                     ab[ka1 + (i__ + k - *ka) * ab_dim1] = work[i__ + k - *ka] 
01498                             * t + work[*n + i__ + k - *ka] * ab[ka1 + (i__ + 
01499                             k - *ka) * ab_dim1];
01500                     ra1 = ra;
01501                 }
01502             }
01503 /* Computing MAX */
01504             i__3 = 1, i__1 = k + i0 - m + 1;
01505             j2 = i__ + k + 1 - max(i__3,i__1) * ka1;
01506             nr = (j2 + *ka - 1) / ka1;
01507             j1 = j2 - (nr - 1) * ka1;
01508             if (update) {
01509 /* Computing MIN */
01510                 i__3 = j2, i__1 = i__ - (*ka << 1) + k - 1;
01511                 j2t = min(i__3,i__1);
01512             } else {
01513                 j2t = j2;
01514             }
01515             nrt = (j2t + *ka - 1) / ka1;
01516             i__3 = j2t;
01517             i__1 = ka1;
01518             for (j = j1; i__1 < 0 ? j >= i__3 : j <= i__3; j += i__1) {
01519 
01520 /*              create nonzero element a(j+ka,j-1) outside the band */
01521 /*              and store it in WORK(j) */
01522 
01523                 work[j] *= ab[ka1 + (j - 1) * ab_dim1];
01524                 ab[ka1 + (j - 1) * ab_dim1] = work[*n + j] * ab[ka1 + (j - 1) 
01525                         * ab_dim1];
01526 /* L800: */
01527             }
01528 
01529 /*           generate rotations in 1st set to annihilate elements which */
01530 /*           have been created outside the band */
01531 
01532             if (nrt > 0) {
01533                 slargv_(&nrt, &ab[ka1 + j1 * ab_dim1], &inca, &work[j1], &ka1, 
01534                          &work[*n + j1], &ka1);
01535             }
01536             if (nr > 0) {
01537 
01538 /*              apply rotations in 1st set from the right */
01539 
01540                 i__1 = *ka - 1;
01541                 for (l = 1; l <= i__1; ++l) {
01542                     slartv_(&nr, &ab[l + 1 + j1 * ab_dim1], &inca, &ab[l + 2 
01543                             + (j1 - 1) * ab_dim1], &inca, &work[*n + j1], &
01544                             work[j1], &ka1);
01545 /* L810: */
01546                 }
01547 
01548 /*              apply rotations in 1st set from both sides to diagonal */
01549 /*              blocks */
01550 
01551                 slar2v_(&nr, &ab[j1 * ab_dim1 + 1], &ab[(j1 - 1) * ab_dim1 + 
01552                         1], &ab[(j1 - 1) * ab_dim1 + 2], &inca, &work[*n + j1]
01553 , &work[j1], &ka1);
01554 
01555             }
01556 
01557 /*           start applying rotations in 1st set from the left */
01558 
01559             i__1 = *kb - k + 1;
01560             for (l = *ka - 1; l >= i__1; --l) {
01561                 nrt = (j2 + l - 1) / ka1;
01562                 j1t = j2 - (nrt - 1) * ka1;
01563                 if (nrt > 0) {
01564                     slartv_(&nrt, &ab[ka1 - l + 1 + (j1t - ka1 + l) * ab_dim1]
01565 , &inca, &ab[ka1 - l + (j1t - ka1 + l) * ab_dim1], 
01566                              &inca, &work[*n + j1t], &work[j1t], &ka1);
01567                 }
01568 /* L820: */
01569             }
01570 
01571             if (wantx) {
01572 
01573 /*              post-multiply X by product of rotations in 1st set */
01574 
01575                 i__1 = j2;
01576                 i__3 = ka1;
01577                 for (j = j1; i__3 < 0 ? j >= i__1 : j <= i__1; j += i__3) {
01578                     srot_(&nx, &x[j * x_dim1 + 1], &c__1, &x[(j - 1) * x_dim1 
01579                             + 1], &c__1, &work[*n + j], &work[j]);
01580 /* L830: */
01581                 }
01582             }
01583 /* L840: */
01584         }
01585 
01586         if (update) {
01587             if (i2 > 0 && kbt > 0) {
01588 
01589 /*              create nonzero element a(i+kbt,i+kbt-ka-1) outside the */
01590 /*              band and store it in WORK(m-kb+i+kbt) */
01591 
01592                 work[m - *kb + i__ + kbt] = -bb[kbt + 1 + i__ * bb_dim1] * 
01593                         ra1;
01594             }
01595         }
01596 
01597         for (k = *kb; k >= 1; --k) {
01598             if (update) {
01599 /* Computing MAX */
01600                 i__4 = 2, i__3 = k + i0 - m;
01601                 j2 = i__ + k + 1 - max(i__4,i__3) * ka1;
01602             } else {
01603 /* Computing MAX */
01604                 i__4 = 1, i__3 = k + i0 - m;
01605                 j2 = i__ + k + 1 - max(i__4,i__3) * ka1;
01606             }
01607 
01608 /*           finish applying rotations in 2nd set from the left */
01609 
01610             for (l = *kb - k; l >= 1; --l) {
01611                 nrt = (j2 + *ka + l - 1) / ka1;
01612                 j1t = j2 - (nrt - 1) * ka1;
01613                 if (nrt > 0) {
01614                     slartv_(&nrt, &ab[ka1 - l + 1 + (j1t + l - 1) * ab_dim1], 
01615                             &inca, &ab[ka1 - l + (j1t + l - 1) * ab_dim1], &
01616                             inca, &work[*n + m - *kb + j1t + *ka], &work[m - *
01617                             kb + j1t + *ka], &ka1);
01618                 }
01619 /* L850: */
01620             }
01621             nr = (j2 + *ka - 1) / ka1;
01622             j1 = j2 - (nr - 1) * ka1;
01623             i__4 = j2;
01624             i__3 = ka1;
01625             for (j = j1; i__3 < 0 ? j >= i__4 : j <= i__4; j += i__3) {
01626                 work[m - *kb + j] = work[m - *kb + j + *ka];
01627                 work[*n + m - *kb + j] = work[*n + m - *kb + j + *ka];
01628 /* L860: */
01629             }
01630             i__3 = j2;
01631             i__4 = ka1;
01632             for (j = j1; i__4 < 0 ? j >= i__3 : j <= i__3; j += i__4) {
01633 
01634 /*              create nonzero element a(j+ka,j-1) outside the band */
01635 /*              and store it in WORK(m-kb+j) */
01636 
01637                 work[m - *kb + j] *= ab[ka1 + (j - 1) * ab_dim1];
01638                 ab[ka1 + (j - 1) * ab_dim1] = work[*n + m - *kb + j] * ab[ka1 
01639                         + (j - 1) * ab_dim1];
01640 /* L870: */
01641             }
01642             if (update) {
01643                 if (i__ + k > ka1 && k <= kbt) {
01644                     work[m - *kb + i__ + k - *ka] = work[m - *kb + i__ + k];
01645                 }
01646             }
01647 /* L880: */
01648         }
01649 
01650         for (k = *kb; k >= 1; --k) {
01651 /* Computing MAX */
01652             i__4 = 1, i__3 = k + i0 - m;
01653             j2 = i__ + k + 1 - max(i__4,i__3) * ka1;
01654             nr = (j2 + *ka - 1) / ka1;
01655             j1 = j2 - (nr - 1) * ka1;
01656             if (nr > 0) {
01657 
01658 /*              generate rotations in 2nd set to annihilate elements */
01659 /*              which have been created outside the band */
01660 
01661                 slargv_(&nr, &ab[ka1 + j1 * ab_dim1], &inca, &work[m - *kb + 
01662                         j1], &ka1, &work[*n + m - *kb + j1], &ka1);
01663 
01664 /*              apply rotations in 2nd set from the right */
01665 
01666                 i__4 = *ka - 1;
01667                 for (l = 1; l <= i__4; ++l) {
01668                     slartv_(&nr, &ab[l + 1 + j1 * ab_dim1], &inca, &ab[l + 2 
01669                             + (j1 - 1) * ab_dim1], &inca, &work[*n + m - *kb 
01670                             + j1], &work[m - *kb + j1], &ka1);
01671 /* L890: */
01672                 }
01673 
01674 /*              apply rotations in 2nd set from both sides to diagonal */
01675 /*              blocks */
01676 
01677                 slar2v_(&nr, &ab[j1 * ab_dim1 + 1], &ab[(j1 - 1) * ab_dim1 + 
01678                         1], &ab[(j1 - 1) * ab_dim1 + 2], &inca, &work[*n + m 
01679                         - *kb + j1], &work[m - *kb + j1], &ka1);
01680 
01681             }
01682 
01683 /*           start applying rotations in 2nd set from the left */
01684 
01685             i__4 = *kb - k + 1;
01686             for (l = *ka - 1; l >= i__4; --l) {
01687                 nrt = (j2 + l - 1) / ka1;
01688                 j1t = j2 - (nrt - 1) * ka1;
01689                 if (nrt > 0) {
01690                     slartv_(&nrt, &ab[ka1 - l + 1 + (j1t - ka1 + l) * ab_dim1]
01691 , &inca, &ab[ka1 - l + (j1t - ka1 + l) * ab_dim1], 
01692                              &inca, &work[*n + m - *kb + j1t], &work[m - *kb 
01693                             + j1t], &ka1);
01694                 }
01695 /* L900: */
01696             }
01697 
01698             if (wantx) {
01699 
01700 /*              post-multiply X by product of rotations in 2nd set */
01701 
01702                 i__4 = j2;
01703                 i__3 = ka1;
01704                 for (j = j1; i__3 < 0 ? j >= i__4 : j <= i__4; j += i__3) {
01705                     srot_(&nx, &x[j * x_dim1 + 1], &c__1, &x[(j - 1) * x_dim1 
01706                             + 1], &c__1, &work[*n + m - *kb + j], &work[m - *
01707                             kb + j]);
01708 /* L910: */
01709                 }
01710             }
01711 /* L920: */
01712         }
01713 
01714         i__3 = *kb - 1;
01715         for (k = 1; k <= i__3; ++k) {
01716 /* Computing MAX */
01717             i__4 = 1, i__1 = k + i0 - m + 1;
01718             j2 = i__ + k + 1 - max(i__4,i__1) * ka1;
01719 
01720 /*           finish applying rotations in 1st set from the left */
01721 
01722             for (l = *kb - k; l >= 1; --l) {
01723                 nrt = (j2 + l - 1) / ka1;
01724                 j1t = j2 - (nrt - 1) * ka1;
01725                 if (nrt > 0) {
01726                     slartv_(&nrt, &ab[ka1 - l + 1 + (j1t - ka1 + l) * ab_dim1]
01727 , &inca, &ab[ka1 - l + (j1t - ka1 + l) * ab_dim1], 
01728                              &inca, &work[*n + j1t], &work[j1t], &ka1);
01729                 }
01730 /* L930: */
01731             }
01732 /* L940: */
01733         }
01734 
01735         if (*kb > 1) {
01736 /* Computing MIN */
01737             i__4 = i__ + *kb;
01738             i__3 = min(i__4,m) - (*ka << 1) - 1;
01739             for (j = 2; j <= i__3; ++j) {
01740                 work[*n + j] = work[*n + j + *ka];
01741                 work[j] = work[j + *ka];
01742 /* L950: */
01743             }
01744         }
01745 
01746     }
01747 
01748     goto L490;
01749 
01750 /*     End of SSBGST */
01751 
01752 } /* ssbgst_ */


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