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


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