00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "f2c.h"
00014 #include "blaswrap.h"
00015
00016
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 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
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
00033 void r_cnjg(complex *, complex *);
00034
00035
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 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 int cgeru_(integer *, integer *, complex *,
00051 complex *, integer *, complex *, integer *, complex *, integer *);
00052 logical upper, wantx;
00053 extern 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 int clartv_(integer *, complex *, integer *,
00063 complex *, integer *, real *, complex *, integer *);
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
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
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
00206
00207 if (*n == 0) {
00208 return 0;
00209 }
00210
00211 inca = *ldab * ka1;
00212
00213
00214
00215 if (wantx) {
00216 claset_("Full", n, n, &c_b1, &c_b2, &x[x_offset], ldx);
00217 }
00218
00219
00220
00221
00222
00223 m = (*n + *kb) / 2;
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284 update = TRUE_;
00285 i__ = *n + 1;
00286 L10:
00287 if (update) {
00288 --i__;
00289
00290 i__1 = *kb, i__2 = i__ - 1;
00291 kbt = min(i__1,i__2);
00292 i0 = i__ - 1;
00293
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
00316
00317 if (update) {
00318
00319
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
00334 }
00335
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
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
00374 }
00375
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
00390 }
00391
00392 }
00393 i__3 = i1;
00394 for (j = i__; j <= i__3; ++j) {
00395
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
00410 }
00411
00412 }
00413
00414 if (wantx) {
00415
00416
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
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
00437
00438
00439
00440 i__3 = *kb - 1;
00441 for (k = 1; k <= i__3; ++k) {
00442 if (update) {
00443
00444
00445
00446
00447 if (i__ - k + *ka < *n && i__ - k > 1) {
00448
00449
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
00456
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
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
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
00504
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
00520 }
00521
00522
00523
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
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
00539 }
00540
00541
00542
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
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
00562 }
00563
00564 if (wantx) {
00565
00566
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
00576 }
00577 }
00578
00579 }
00580
00581 if (update) {
00582 if (i2 <= *n && kbt > 0) {
00583
00584
00585
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
00599 i__3 = 2, i__2 = k - i0 + 1;
00600 j2 = i__ - k - 1 + max(i__3,i__2) * ka1;
00601 } else {
00602
00603 i__3 = 1, i__2 = k - i0 + 1;
00604 j2 = i__ - k - 1 + max(i__3,i__2) * ka1;
00605 }
00606
00607
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
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
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
00634
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
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
00659 }
00660
00661 for (k = *kb; k >= 1; --k) {
00662
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
00670
00671
00672 clargv_(&nr, &ab[j2 * ab_dim1 + 1], &inca, &work[j2], &ka1, &
00673 rwork[j2], &ka1);
00674
00675
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
00683 }
00684
00685
00686
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
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
00706 }
00707
00708 if (wantx) {
00709
00710
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
00720 }
00721 }
00722
00723 }
00724
00725 i__2 = *kb - 1;
00726 for (k = 1; k <= i__2; ++k) {
00727
00728 i__3 = 1, i__4 = k - i0 + 2;
00729 j2 = i__ - k - 1 + max(i__3,i__4) * ka1;
00730
00731
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
00741 }
00742
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
00753 }
00754 }
00755
00756 } else {
00757
00758
00759
00760 if (update) {
00761
00762
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
00777 }
00778
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
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
00817 }
00818
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
00833 }
00834
00835 }
00836 i__4 = i1;
00837 for (j = i__; j <= i__4; ++j) {
00838
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
00853 }
00854
00855 }
00856
00857 if (wantx) {
00858
00859
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
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
00881
00882
00883
00884 i__4 = *kb - 1;
00885 for (k = 1; k <= i__4; ++k) {
00886 if (update) {
00887
00888
00889
00890
00891 if (i__ - k + *ka < *n && i__ - k > 1) {
00892
00893
00894
00895 clartg_(&ab[ka1 - k + i__ * ab_dim1], &ra1, &rwork[i__ -
00896 k + *ka - m], &work[i__ - k + *ka - m], &ra);
00897
00898
00899
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
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
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
00947
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
00963 }
00964
00965
00966
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
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
00982 }
00983
00984
00985
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
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
01005 }
01006
01007 if (wantx) {
01008
01009
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
01019 }
01020 }
01021
01022 }
01023
01024 if (update) {
01025 if (i2 <= *n && kbt > 0) {
01026
01027
01028
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
01042 i__4 = 2, i__3 = k - i0 + 1;
01043 j2 = i__ - k - 1 + max(i__4,i__3) * ka1;
01044 } else {
01045
01046 i__4 = 1, i__3 = k - i0 + 1;
01047 j2 = i__ - k - 1 + max(i__4,i__3) * ka1;
01048 }
01049
01050
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
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
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
01077
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
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
01102 }
01103
01104 for (k = *kb; k >= 1; --k) {
01105
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
01113
01114
01115 clargv_(&nr, &ab[ka1 + (j2 - *ka) * ab_dim1], &inca, &work[j2]
01116 , &ka1, &rwork[j2], &ka1);
01117
01118
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
01126 }
01127
01128
01129
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
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
01149 }
01150
01151 if (wantx) {
01152
01153
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
01162 }
01163 }
01164
01165 }
01166
01167 i__3 = *kb - 1;
01168 for (k = 1; k <= i__3; ++k) {
01169
01170 i__4 = 1, i__1 = k - i0 + 2;
01171 j2 = i__ - k - 1 + max(i__4,i__1) * ka1;
01172
01173
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
01183 }
01184
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
01195 }
01196 }
01197
01198 }
01199
01200 goto L10;
01201
01202 L480:
01203
01204
01205
01206
01207
01208
01209
01210
01211
01212
01213
01214
01215
01216
01217
01218
01219
01220 update = TRUE_;
01221 i__ = 0;
01222 L490:
01223 if (update) {
01224 ++i__;
01225
01226 i__3 = *kb, i__4 = m - i__;
01227 kbt = min(i__3,i__4);
01228 i0 = i__ + 1;
01229
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
01258
01259 if (update) {
01260
01261
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
01276 }
01277
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
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
01316 }
01317
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
01332 }
01333
01334 }
01335 i__3 = i__;
01336 for (j = i1; j <= i__3; ++j) {
01337
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
01352 }
01353
01354 }
01355
01356 if (wantx) {
01357
01358
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
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
01378
01379
01380 i__3 = *kb - 1;
01381 for (k = 1; k <= i__3; ++k) {
01382 if (update) {
01383
01384
01385
01386
01387 if (i__ + k - ka1 > 0 && i__ + k < m) {
01388
01389
01390
01391 clartg_(&ab[k + 1 + i__ * ab_dim1], &ra1, &rwork[i__ + k
01392 - *ka], &work[i__ + k - *ka], &ra);
01393
01394
01395
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
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
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
01443
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
01459 }
01460
01461
01462
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
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
01478 }
01479
01480
01481
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
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
01502 }
01503
01504 if (wantx) {
01505
01506
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
01514 }
01515 }
01516
01517 }
01518
01519 if (update) {
01520 if (i2 > 0 && kbt > 0) {
01521
01522
01523
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
01537 i__3 = 2, i__4 = k + i0 - m;
01538 j2 = i__ + k + 1 - max(i__3,i__4) * ka1;
01539 } else {
01540
01541 i__3 = 1, i__4 = k + i0 - m;
01542 j2 = i__ + k + 1 - max(i__3,i__4) * ka1;
01543 }
01544
01545
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
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
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
01574
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
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
01599 }
01600
01601 for (k = *kb; k >= 1; --k) {
01602
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
01610
01611
01612 clargv_(&nr, &ab[(j1 + *ka) * ab_dim1 + 1], &inca, &work[m - *
01613 kb + j1], &ka1, &rwork[m - *kb + j1], &ka1);
01614
01615
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
01623 }
01624
01625
01626
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
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
01647 }
01648
01649 if (wantx) {
01650
01651
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
01660 }
01661 }
01662
01663 }
01664
01665 i__4 = *kb - 1;
01666 for (k = 1; k <= i__4; ++k) {
01667
01668 i__3 = 1, i__1 = k + i0 - m + 1;
01669 j2 = i__ + k + 1 - max(i__3,i__1) * ka1;
01670
01671
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
01682 }
01683
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
01694 }
01695 }
01696
01697 } else {
01698
01699
01700
01701 if (update) {
01702
01703
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
01718 }
01719
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
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
01758 }
01759
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
01774 }
01775
01776 }
01777 i__4 = i__;
01778 for (j = i1; j <= i__4; ++j) {
01779
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
01794 }
01795
01796 }
01797
01798 if (wantx) {
01799
01800
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
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
01819
01820
01821 i__4 = *kb - 1;
01822 for (k = 1; k <= i__4; ++k) {
01823 if (update) {
01824
01825
01826
01827
01828 if (i__ + k - ka1 > 0 && i__ + k < m) {
01829
01830
01831
01832 clartg_(&ab[ka1 - k + (i__ + k - *ka) * ab_dim1], &ra1, &
01833 rwork[i__ + k - *ka], &work[i__ + k - *ka], &ra);
01834
01835
01836
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
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
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
01884
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
01900 }
01901
01902
01903
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
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
01919 }
01920
01921
01922
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
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
01943 }
01944
01945 if (wantx) {
01946
01947
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
01956 }
01957 }
01958
01959 }
01960
01961 if (update) {
01962 if (i2 > 0 && kbt > 0) {
01963
01964
01965
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
01979 i__4 = 2, i__3 = k + i0 - m;
01980 j2 = i__ + k + 1 - max(i__4,i__3) * ka1;
01981 } else {
01982
01983 i__4 = 1, i__3 = k + i0 - m;
01984 j2 = i__ + k + 1 - max(i__4,i__3) * ka1;
01985 }
01986
01987
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
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
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
02016
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
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
02041 }
02042
02043 for (k = *kb; k >= 1; --k) {
02044
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
02052
02053
02054 clargv_(&nr, &ab[ka1 + j1 * ab_dim1], &inca, &work[m - *kb +
02055 j1], &ka1, &rwork[m - *kb + j1], &ka1);
02056
02057
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
02065 }
02066
02067
02068
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
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
02090 }
02091
02092 if (wantx) {
02093
02094
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
02103 }
02104 }
02105
02106 }
02107
02108 i__3 = *kb - 1;
02109 for (k = 1; k <= i__3; ++k) {
02110
02111 i__4 = 1, i__1 = k + i0 - m + 1;
02112 j2 = i__ + k + 1 - max(i__4,i__1) * ka1;
02113
02114
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
02125 }
02126
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
02137 }
02138 }
02139
02140 }
02141
02142 goto L490;
02143
02144
02145
02146 }