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 doublereal c_b8 = 0.;
00019 static doublereal c_b9 = 1.;
00020 static integer c__1 = 1;
00021 static doublereal c_b20 = -1.;
00022
00023 int dsbgst_(char *vect, char *uplo, integer *n, integer *ka,
00024 integer *kb, doublereal *ab, integer *ldab, doublereal *bb, integer *
00025 ldbb, doublereal *x, integer *ldx, doublereal *work, integer *info)
00026 {
00027
00028 integer ab_dim1, ab_offset, bb_dim1, bb_offset, x_dim1, x_offset, i__1,
00029 i__2, i__3, i__4;
00030 doublereal d__1;
00031
00032
00033 integer i__, j, k, l, m;
00034 doublereal t;
00035 integer i0, i1, i2, j1, j2;
00036 doublereal ra;
00037 integer nr, nx, ka1, kb1;
00038 doublereal ra1;
00039 integer j1t, j2t;
00040 doublereal bii;
00041 integer kbt, nrt, inca;
00042 extern int dger_(integer *, integer *, doublereal *,
00043 doublereal *, integer *, doublereal *, integer *, doublereal *,
00044 integer *), drot_(integer *, doublereal *, integer *, doublereal *
00045 , integer *, doublereal *, doublereal *), dscal_(integer *,
00046 doublereal *, doublereal *, integer *);
00047 extern logical lsame_(char *, char *);
00048 logical upper, wantx;
00049 extern int dlar2v_(integer *, doublereal *, doublereal *,
00050 doublereal *, integer *, doublereal *, doublereal *, integer *),
00051 dlaset_(char *, integer *, integer *, doublereal *, doublereal *,
00052 doublereal *, integer *), dlartg_(doublereal *,
00053 doublereal *, doublereal *, doublereal *, doublereal *), xerbla_(
00054 char *, integer *), dlargv_(integer *, doublereal *,
00055 integer *, doublereal *, integer *, doublereal *, integer *);
00056 logical update;
00057 extern int dlartv_(integer *, doublereal *, integer *,
00058 doublereal *, integer *, doublereal *, doublereal *, integer *);
00059
00060
00061
00062
00063
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 ab_dim1 = *ldab;
00158 ab_offset = 1 + ab_dim1;
00159 ab -= ab_offset;
00160 bb_dim1 = *ldbb;
00161 bb_offset = 1 + bb_dim1;
00162 bb -= bb_offset;
00163 x_dim1 = *ldx;
00164 x_offset = 1 + x_dim1;
00165 x -= x_offset;
00166 --work;
00167
00168
00169 wantx = lsame_(vect, "V");
00170 upper = lsame_(uplo, "U");
00171 ka1 = *ka + 1;
00172 kb1 = *kb + 1;
00173 *info = 0;
00174 if (! wantx && ! lsame_(vect, "N")) {
00175 *info = -1;
00176 } else if (! upper && ! lsame_(uplo, "L")) {
00177 *info = -2;
00178 } else if (*n < 0) {
00179 *info = -3;
00180 } else if (*ka < 0) {
00181 *info = -4;
00182 } else if (*kb < 0 || *kb > *ka) {
00183 *info = -5;
00184 } else if (*ldab < *ka + 1) {
00185 *info = -7;
00186 } else if (*ldbb < *kb + 1) {
00187 *info = -9;
00188 } else if (*ldx < 1 || wantx && *ldx < max(1,*n)) {
00189 *info = -11;
00190 }
00191 if (*info != 0) {
00192 i__1 = -(*info);
00193 xerbla_("DSBGST", &i__1);
00194 return 0;
00195 }
00196
00197
00198
00199 if (*n == 0) {
00200 return 0;
00201 }
00202
00203 inca = *ldab * ka1;
00204
00205
00206
00207 if (wantx) {
00208 dlaset_("Full", n, n, &c_b8, &c_b9, &x[x_offset], ldx);
00209 }
00210
00211
00212
00213
00214
00215 m = (*n + *kb) / 2;
00216
00217
00218
00219
00220
00221
00222
00223
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 update = TRUE_;
00279 i__ = *n + 1;
00280 L10:
00281 if (update) {
00282 --i__;
00283
00284 i__1 = *kb, i__2 = i__ - 1;
00285 kbt = min(i__1,i__2);
00286 i0 = i__ - 1;
00287
00288 i__1 = *n, i__2 = i__ + *ka;
00289 i1 = min(i__1,i__2);
00290 i2 = i__ - kbt + ka1;
00291 if (i__ < m + 1) {
00292 update = FALSE_;
00293 ++i__;
00294 i0 = m;
00295 if (*ka == 0) {
00296 goto L480;
00297 }
00298 goto L10;
00299 }
00300 } else {
00301 i__ += *ka;
00302 if (i__ > *n - 1) {
00303 goto L480;
00304 }
00305 }
00306
00307 if (upper) {
00308
00309
00310
00311 if (update) {
00312
00313
00314
00315 bii = bb[kb1 + i__ * bb_dim1];
00316 i__1 = i1;
00317 for (j = i__; j <= i__1; ++j) {
00318 ab[i__ - j + ka1 + j * ab_dim1] /= bii;
00319
00320 }
00321
00322 i__1 = 1, i__2 = i__ - *ka;
00323 i__3 = i__;
00324 for (j = max(i__1,i__2); j <= i__3; ++j) {
00325 ab[j - i__ + ka1 + i__ * ab_dim1] /= bii;
00326
00327 }
00328 i__3 = i__ - 1;
00329 for (k = i__ - kbt; k <= i__3; ++k) {
00330 i__1 = k;
00331 for (j = i__ - kbt; j <= i__1; ++j) {
00332 ab[j - k + ka1 + k * ab_dim1] = ab[j - k + ka1 + k *
00333 ab_dim1] - bb[j - i__ + kb1 + i__ * bb_dim1] * ab[
00334 k - i__ + ka1 + i__ * ab_dim1] - bb[k - i__ + kb1
00335 + i__ * bb_dim1] * ab[j - i__ + ka1 + i__ *
00336 ab_dim1] + ab[ka1 + i__ * ab_dim1] * bb[j - i__ +
00337 kb1 + i__ * bb_dim1] * bb[k - i__ + kb1 + i__ *
00338 bb_dim1];
00339
00340 }
00341
00342 i__1 = 1, i__2 = i__ - *ka;
00343 i__4 = i__ - kbt - 1;
00344 for (j = max(i__1,i__2); j <= i__4; ++j) {
00345 ab[j - k + ka1 + k * ab_dim1] -= bb[k - i__ + kb1 + i__ *
00346 bb_dim1] * ab[j - i__ + ka1 + i__ * ab_dim1];
00347
00348 }
00349
00350 }
00351 i__3 = i1;
00352 for (j = i__; j <= i__3; ++j) {
00353
00354 i__4 = j - *ka, i__1 = i__ - kbt;
00355 i__2 = i__ - 1;
00356 for (k = max(i__4,i__1); k <= i__2; ++k) {
00357 ab[k - j + ka1 + j * ab_dim1] -= bb[k - i__ + kb1 + i__ *
00358 bb_dim1] * ab[i__ - j + ka1 + j * ab_dim1];
00359
00360 }
00361
00362 }
00363
00364 if (wantx) {
00365
00366
00367
00368 i__3 = *n - m;
00369 d__1 = 1. / bii;
00370 dscal_(&i__3, &d__1, &x[m + 1 + i__ * x_dim1], &c__1);
00371 if (kbt > 0) {
00372 i__3 = *n - m;
00373 dger_(&i__3, &kbt, &c_b20, &x[m + 1 + i__ * x_dim1], &
00374 c__1, &bb[kb1 - kbt + i__ * bb_dim1], &c__1, &x[m
00375 + 1 + (i__ - kbt) * x_dim1], ldx);
00376 }
00377 }
00378
00379
00380
00381 ra1 = ab[i__ - i1 + ka1 + i1 * ab_dim1];
00382 }
00383
00384
00385
00386
00387
00388 i__3 = *kb - 1;
00389 for (k = 1; k <= i__3; ++k) {
00390 if (update) {
00391
00392
00393
00394
00395 if (i__ - k + *ka < *n && i__ - k > 1) {
00396
00397
00398
00399 dlartg_(&ab[k + 1 + (i__ - k + *ka) * ab_dim1], &ra1, &
00400 work[*n + i__ - k + *ka - m], &work[i__ - k + *ka
00401 - m], &ra);
00402
00403
00404
00405
00406 t = -bb[kb1 - k + i__ * bb_dim1] * ra1;
00407 work[i__ - k] = work[*n + i__ - k + *ka - m] * t - work[
00408 i__ - k + *ka - m] * ab[(i__ - k + *ka) * ab_dim1
00409 + 1];
00410 ab[(i__ - k + *ka) * ab_dim1 + 1] = work[i__ - k + *ka -
00411 m] * t + work[*n + i__ - k + *ka - m] * ab[(i__ -
00412 k + *ka) * ab_dim1 + 1];
00413 ra1 = ra;
00414 }
00415 }
00416
00417 i__2 = 1, i__4 = k - i0 + 2;
00418 j2 = i__ - k - 1 + max(i__2,i__4) * ka1;
00419 nr = (*n - j2 + *ka) / ka1;
00420 j1 = j2 + (nr - 1) * ka1;
00421 if (update) {
00422
00423 i__2 = j2, i__4 = i__ + (*ka << 1) - k + 1;
00424 j2t = max(i__2,i__4);
00425 } else {
00426 j2t = j2;
00427 }
00428 nrt = (*n - j2t + *ka) / ka1;
00429 i__2 = j1;
00430 i__4 = ka1;
00431 for (j = j2t; i__4 < 0 ? j >= i__2 : j <= i__2; j += i__4) {
00432
00433
00434
00435
00436 work[j - m] *= ab[(j + 1) * ab_dim1 + 1];
00437 ab[(j + 1) * ab_dim1 + 1] = work[*n + j - m] * ab[(j + 1) *
00438 ab_dim1 + 1];
00439
00440 }
00441
00442
00443
00444
00445 if (nrt > 0) {
00446 dlargv_(&nrt, &ab[j2t * ab_dim1 + 1], &inca, &work[j2t - m], &
00447 ka1, &work[*n + j2t - m], &ka1);
00448 }
00449 if (nr > 0) {
00450
00451
00452
00453 i__4 = *ka - 1;
00454 for (l = 1; l <= i__4; ++l) {
00455 dlartv_(&nr, &ab[ka1 - l + j2 * ab_dim1], &inca, &ab[*ka
00456 - l + (j2 + 1) * ab_dim1], &inca, &work[*n + j2 -
00457 m], &work[j2 - m], &ka1);
00458
00459 }
00460
00461
00462
00463
00464 dlar2v_(&nr, &ab[ka1 + j2 * ab_dim1], &ab[ka1 + (j2 + 1) *
00465 ab_dim1], &ab[*ka + (j2 + 1) * ab_dim1], &inca, &work[
00466 *n + j2 - m], &work[j2 - m], &ka1);
00467
00468 }
00469
00470
00471
00472 i__4 = *kb - k + 1;
00473 for (l = *ka - 1; l >= i__4; --l) {
00474 nrt = (*n - j2 + l) / ka1;
00475 if (nrt > 0) {
00476 dlartv_(&nrt, &ab[l + (j2 + ka1 - l) * ab_dim1], &inca, &
00477 ab[l + 1 + (j2 + ka1 - l) * ab_dim1], &inca, &
00478 work[*n + j2 - m], &work[j2 - m], &ka1);
00479 }
00480
00481 }
00482
00483 if (wantx) {
00484
00485
00486
00487 i__4 = j1;
00488 i__2 = ka1;
00489 for (j = j2; i__2 < 0 ? j >= i__4 : j <= i__4; j += i__2) {
00490 i__1 = *n - m;
00491 drot_(&i__1, &x[m + 1 + j * x_dim1], &c__1, &x[m + 1 + (j
00492 + 1) * x_dim1], &c__1, &work[*n + j - m], &work[j
00493 - m]);
00494
00495 }
00496 }
00497
00498 }
00499
00500 if (update) {
00501 if (i2 <= *n && kbt > 0) {
00502
00503
00504
00505
00506 work[i__ - kbt] = -bb[kb1 - kbt + i__ * bb_dim1] * ra1;
00507 }
00508 }
00509
00510 for (k = *kb; k >= 1; --k) {
00511 if (update) {
00512
00513 i__3 = 2, i__2 = k - i0 + 1;
00514 j2 = i__ - k - 1 + max(i__3,i__2) * ka1;
00515 } else {
00516
00517 i__3 = 1, i__2 = k - i0 + 1;
00518 j2 = i__ - k - 1 + max(i__3,i__2) * ka1;
00519 }
00520
00521
00522
00523 for (l = *kb - k; l >= 1; --l) {
00524 nrt = (*n - j2 + *ka + l) / ka1;
00525 if (nrt > 0) {
00526 dlartv_(&nrt, &ab[l + (j2 - l + 1) * ab_dim1], &inca, &ab[
00527 l + 1 + (j2 - l + 1) * ab_dim1], &inca, &work[*n
00528 + j2 - *ka], &work[j2 - *ka], &ka1);
00529 }
00530
00531 }
00532 nr = (*n - j2 + *ka) / ka1;
00533 j1 = j2 + (nr - 1) * ka1;
00534 i__3 = j2;
00535 i__2 = -ka1;
00536 for (j = j1; i__2 < 0 ? j >= i__3 : j <= i__3; j += i__2) {
00537 work[j] = work[j - *ka];
00538 work[*n + j] = work[*n + j - *ka];
00539
00540 }
00541 i__2 = j1;
00542 i__3 = ka1;
00543 for (j = j2; i__3 < 0 ? j >= i__2 : j <= i__2; j += i__3) {
00544
00545
00546
00547
00548 work[j] *= ab[(j + 1) * ab_dim1 + 1];
00549 ab[(j + 1) * ab_dim1 + 1] = work[*n + j] * ab[(j + 1) *
00550 ab_dim1 + 1];
00551
00552 }
00553 if (update) {
00554 if (i__ - k < *n - *ka && k <= kbt) {
00555 work[i__ - k + *ka] = work[i__ - k];
00556 }
00557 }
00558
00559 }
00560
00561 for (k = *kb; k >= 1; --k) {
00562
00563 i__3 = 1, i__2 = k - i0 + 1;
00564 j2 = i__ - k - 1 + max(i__3,i__2) * ka1;
00565 nr = (*n - j2 + *ka) / ka1;
00566 j1 = j2 + (nr - 1) * ka1;
00567 if (nr > 0) {
00568
00569
00570
00571
00572 dlargv_(&nr, &ab[j2 * ab_dim1 + 1], &inca, &work[j2], &ka1, &
00573 work[*n + j2], &ka1);
00574
00575
00576
00577 i__3 = *ka - 1;
00578 for (l = 1; l <= i__3; ++l) {
00579 dlartv_(&nr, &ab[ka1 - l + j2 * ab_dim1], &inca, &ab[*ka
00580 - l + (j2 + 1) * ab_dim1], &inca, &work[*n + j2],
00581 &work[j2], &ka1);
00582
00583 }
00584
00585
00586
00587
00588 dlar2v_(&nr, &ab[ka1 + j2 * ab_dim1], &ab[ka1 + (j2 + 1) *
00589 ab_dim1], &ab[*ka + (j2 + 1) * ab_dim1], &inca, &work[
00590 *n + j2], &work[j2], &ka1);
00591
00592 }
00593
00594
00595
00596 i__3 = *kb - k + 1;
00597 for (l = *ka - 1; l >= i__3; --l) {
00598 nrt = (*n - j2 + l) / ka1;
00599 if (nrt > 0) {
00600 dlartv_(&nrt, &ab[l + (j2 + ka1 - l) * ab_dim1], &inca, &
00601 ab[l + 1 + (j2 + ka1 - l) * ab_dim1], &inca, &
00602 work[*n + j2], &work[j2], &ka1);
00603 }
00604
00605 }
00606
00607 if (wantx) {
00608
00609
00610
00611 i__3 = j1;
00612 i__2 = ka1;
00613 for (j = j2; i__2 < 0 ? j >= i__3 : j <= i__3; j += i__2) {
00614 i__4 = *n - m;
00615 drot_(&i__4, &x[m + 1 + j * x_dim1], &c__1, &x[m + 1 + (j
00616 + 1) * x_dim1], &c__1, &work[*n + j], &work[j]);
00617
00618 }
00619 }
00620
00621 }
00622
00623 i__2 = *kb - 1;
00624 for (k = 1; k <= i__2; ++k) {
00625
00626 i__3 = 1, i__4 = k - i0 + 2;
00627 j2 = i__ - k - 1 + max(i__3,i__4) * ka1;
00628
00629
00630
00631 for (l = *kb - k; l >= 1; --l) {
00632 nrt = (*n - j2 + l) / ka1;
00633 if (nrt > 0) {
00634 dlartv_(&nrt, &ab[l + (j2 + ka1 - l) * ab_dim1], &inca, &
00635 ab[l + 1 + (j2 + ka1 - l) * ab_dim1], &inca, &
00636 work[*n + j2 - m], &work[j2 - m], &ka1);
00637 }
00638
00639 }
00640
00641 }
00642
00643 if (*kb > 1) {
00644 i__2 = i__ - *kb + (*ka << 1) + 1;
00645 for (j = *n - 1; j >= i__2; --j) {
00646 work[*n + j - m] = work[*n + j - *ka - m];
00647 work[j - m] = work[j - *ka - m];
00648
00649 }
00650 }
00651
00652 } else {
00653
00654
00655
00656 if (update) {
00657
00658
00659
00660 bii = bb[i__ * bb_dim1 + 1];
00661 i__2 = i1;
00662 for (j = i__; j <= i__2; ++j) {
00663 ab[j - i__ + 1 + i__ * ab_dim1] /= bii;
00664
00665 }
00666
00667 i__2 = 1, i__3 = i__ - *ka;
00668 i__4 = i__;
00669 for (j = max(i__2,i__3); j <= i__4; ++j) {
00670 ab[i__ - j + 1 + j * ab_dim1] /= bii;
00671
00672 }
00673 i__4 = i__ - 1;
00674 for (k = i__ - kbt; k <= i__4; ++k) {
00675 i__2 = k;
00676 for (j = i__ - kbt; j <= i__2; ++j) {
00677 ab[k - j + 1 + j * ab_dim1] = ab[k - j + 1 + j * ab_dim1]
00678 - bb[i__ - j + 1 + j * bb_dim1] * ab[i__ - k + 1
00679 + k * ab_dim1] - bb[i__ - k + 1 + k * bb_dim1] *
00680 ab[i__ - j + 1 + j * ab_dim1] + ab[i__ * ab_dim1
00681 + 1] * bb[i__ - j + 1 + j * bb_dim1] * bb[i__ - k
00682 + 1 + k * bb_dim1];
00683
00684 }
00685
00686 i__2 = 1, i__3 = i__ - *ka;
00687 i__1 = i__ - kbt - 1;
00688 for (j = max(i__2,i__3); j <= i__1; ++j) {
00689 ab[k - j + 1 + j * ab_dim1] -= bb[i__ - k + 1 + k *
00690 bb_dim1] * ab[i__ - j + 1 + j * ab_dim1];
00691
00692 }
00693
00694 }
00695 i__4 = i1;
00696 for (j = i__; j <= i__4; ++j) {
00697
00698 i__1 = j - *ka, i__2 = i__ - kbt;
00699 i__3 = i__ - 1;
00700 for (k = max(i__1,i__2); k <= i__3; ++k) {
00701 ab[j - k + 1 + k * ab_dim1] -= bb[i__ - k + 1 + k *
00702 bb_dim1] * ab[j - i__ + 1 + i__ * ab_dim1];
00703
00704 }
00705
00706 }
00707
00708 if (wantx) {
00709
00710
00711
00712 i__4 = *n - m;
00713 d__1 = 1. / bii;
00714 dscal_(&i__4, &d__1, &x[m + 1 + i__ * x_dim1], &c__1);
00715 if (kbt > 0) {
00716 i__4 = *n - m;
00717 i__3 = *ldbb - 1;
00718 dger_(&i__4, &kbt, &c_b20, &x[m + 1 + i__ * x_dim1], &
00719 c__1, &bb[kbt + 1 + (i__ - kbt) * bb_dim1], &i__3,
00720 &x[m + 1 + (i__ - kbt) * x_dim1], ldx);
00721 }
00722 }
00723
00724
00725
00726 ra1 = ab[i1 - i__ + 1 + i__ * ab_dim1];
00727 }
00728
00729
00730
00731
00732
00733 i__4 = *kb - 1;
00734 for (k = 1; k <= i__4; ++k) {
00735 if (update) {
00736
00737
00738
00739
00740 if (i__ - k + *ka < *n && i__ - k > 1) {
00741
00742
00743
00744 dlartg_(&ab[ka1 - k + i__ * ab_dim1], &ra1, &work[*n +
00745 i__ - k + *ka - m], &work[i__ - k + *ka - m], &ra)
00746 ;
00747
00748
00749
00750
00751 t = -bb[k + 1 + (i__ - k) * bb_dim1] * ra1;
00752 work[i__ - k] = work[*n + i__ - k + *ka - m] * t - work[
00753 i__ - k + *ka - m] * ab[ka1 + (i__ - k) * ab_dim1]
00754 ;
00755 ab[ka1 + (i__ - k) * ab_dim1] = work[i__ - k + *ka - m] *
00756 t + work[*n + i__ - k + *ka - m] * ab[ka1 + (i__
00757 - k) * ab_dim1];
00758 ra1 = ra;
00759 }
00760 }
00761
00762 i__3 = 1, i__1 = k - i0 + 2;
00763 j2 = i__ - k - 1 + max(i__3,i__1) * ka1;
00764 nr = (*n - j2 + *ka) / ka1;
00765 j1 = j2 + (nr - 1) * ka1;
00766 if (update) {
00767
00768 i__3 = j2, i__1 = i__ + (*ka << 1) - k + 1;
00769 j2t = max(i__3,i__1);
00770 } else {
00771 j2t = j2;
00772 }
00773 nrt = (*n - j2t + *ka) / ka1;
00774 i__3 = j1;
00775 i__1 = ka1;
00776 for (j = j2t; i__1 < 0 ? j >= i__3 : j <= i__3; j += i__1) {
00777
00778
00779
00780
00781 work[j - m] *= ab[ka1 + (j - *ka + 1) * ab_dim1];
00782 ab[ka1 + (j - *ka + 1) * ab_dim1] = work[*n + j - m] * ab[ka1
00783 + (j - *ka + 1) * ab_dim1];
00784
00785 }
00786
00787
00788
00789
00790 if (nrt > 0) {
00791 dlargv_(&nrt, &ab[ka1 + (j2t - *ka) * ab_dim1], &inca, &work[
00792 j2t - m], &ka1, &work[*n + j2t - m], &ka1);
00793 }
00794 if (nr > 0) {
00795
00796
00797
00798 i__1 = *ka - 1;
00799 for (l = 1; l <= i__1; ++l) {
00800 dlartv_(&nr, &ab[l + 1 + (j2 - l) * ab_dim1], &inca, &ab[
00801 l + 2 + (j2 - l) * ab_dim1], &inca, &work[*n + j2
00802 - m], &work[j2 - m], &ka1);
00803
00804 }
00805
00806
00807
00808
00809 dlar2v_(&nr, &ab[j2 * ab_dim1 + 1], &ab[(j2 + 1) * ab_dim1 +
00810 1], &ab[j2 * ab_dim1 + 2], &inca, &work[*n + j2 - m],
00811 &work[j2 - m], &ka1);
00812
00813 }
00814
00815
00816
00817 i__1 = *kb - k + 1;
00818 for (l = *ka - 1; l >= i__1; --l) {
00819 nrt = (*n - j2 + l) / ka1;
00820 if (nrt > 0) {
00821 dlartv_(&nrt, &ab[ka1 - l + 1 + j2 * ab_dim1], &inca, &ab[
00822 ka1 - l + (j2 + 1) * ab_dim1], &inca, &work[*n +
00823 j2 - m], &work[j2 - m], &ka1);
00824 }
00825
00826 }
00827
00828 if (wantx) {
00829
00830
00831
00832 i__1 = j1;
00833 i__3 = ka1;
00834 for (j = j2; i__3 < 0 ? j >= i__1 : j <= i__1; j += i__3) {
00835 i__2 = *n - m;
00836 drot_(&i__2, &x[m + 1 + j * x_dim1], &c__1, &x[m + 1 + (j
00837 + 1) * x_dim1], &c__1, &work[*n + j - m], &work[j
00838 - m]);
00839
00840 }
00841 }
00842
00843 }
00844
00845 if (update) {
00846 if (i2 <= *n && kbt > 0) {
00847
00848
00849
00850
00851 work[i__ - kbt] = -bb[kbt + 1 + (i__ - kbt) * bb_dim1] * ra1;
00852 }
00853 }
00854
00855 for (k = *kb; k >= 1; --k) {
00856 if (update) {
00857
00858 i__4 = 2, i__3 = k - i0 + 1;
00859 j2 = i__ - k - 1 + max(i__4,i__3) * ka1;
00860 } else {
00861
00862 i__4 = 1, i__3 = k - i0 + 1;
00863 j2 = i__ - k - 1 + max(i__4,i__3) * ka1;
00864 }
00865
00866
00867
00868 for (l = *kb - k; l >= 1; --l) {
00869 nrt = (*n - j2 + *ka + l) / ka1;
00870 if (nrt > 0) {
00871 dlartv_(&nrt, &ab[ka1 - l + 1 + (j2 - *ka) * ab_dim1], &
00872 inca, &ab[ka1 - l + (j2 - *ka + 1) * ab_dim1], &
00873 inca, &work[*n + j2 - *ka], &work[j2 - *ka], &ka1)
00874 ;
00875 }
00876
00877 }
00878 nr = (*n - j2 + *ka) / ka1;
00879 j1 = j2 + (nr - 1) * ka1;
00880 i__4 = j2;
00881 i__3 = -ka1;
00882 for (j = j1; i__3 < 0 ? j >= i__4 : j <= i__4; j += i__3) {
00883 work[j] = work[j - *ka];
00884 work[*n + j] = work[*n + j - *ka];
00885
00886 }
00887 i__3 = j1;
00888 i__4 = ka1;
00889 for (j = j2; i__4 < 0 ? j >= i__3 : j <= i__3; j += i__4) {
00890
00891
00892
00893
00894 work[j] *= ab[ka1 + (j - *ka + 1) * ab_dim1];
00895 ab[ka1 + (j - *ka + 1) * ab_dim1] = work[*n + j] * ab[ka1 + (
00896 j - *ka + 1) * ab_dim1];
00897
00898 }
00899 if (update) {
00900 if (i__ - k < *n - *ka && k <= kbt) {
00901 work[i__ - k + *ka] = work[i__ - k];
00902 }
00903 }
00904
00905 }
00906
00907 for (k = *kb; k >= 1; --k) {
00908
00909 i__4 = 1, i__3 = k - i0 + 1;
00910 j2 = i__ - k - 1 + max(i__4,i__3) * ka1;
00911 nr = (*n - j2 + *ka) / ka1;
00912 j1 = j2 + (nr - 1) * ka1;
00913 if (nr > 0) {
00914
00915
00916
00917
00918 dlargv_(&nr, &ab[ka1 + (j2 - *ka) * ab_dim1], &inca, &work[j2]
00919 , &ka1, &work[*n + j2], &ka1);
00920
00921
00922
00923 i__4 = *ka - 1;
00924 for (l = 1; l <= i__4; ++l) {
00925 dlartv_(&nr, &ab[l + 1 + (j2 - l) * ab_dim1], &inca, &ab[
00926 l + 2 + (j2 - l) * ab_dim1], &inca, &work[*n + j2]
00927 , &work[j2], &ka1);
00928
00929 }
00930
00931
00932
00933
00934 dlar2v_(&nr, &ab[j2 * ab_dim1 + 1], &ab[(j2 + 1) * ab_dim1 +
00935 1], &ab[j2 * ab_dim1 + 2], &inca, &work[*n + j2], &
00936 work[j2], &ka1);
00937
00938 }
00939
00940
00941
00942 i__4 = *kb - k + 1;
00943 for (l = *ka - 1; l >= i__4; --l) {
00944 nrt = (*n - j2 + l) / ka1;
00945 if (nrt > 0) {
00946 dlartv_(&nrt, &ab[ka1 - l + 1 + j2 * ab_dim1], &inca, &ab[
00947 ka1 - l + (j2 + 1) * ab_dim1], &inca, &work[*n +
00948 j2], &work[j2], &ka1);
00949 }
00950
00951 }
00952
00953 if (wantx) {
00954
00955
00956
00957 i__4 = j1;
00958 i__3 = ka1;
00959 for (j = j2; i__3 < 0 ? j >= i__4 : j <= i__4; j += i__3) {
00960 i__1 = *n - m;
00961 drot_(&i__1, &x[m + 1 + j * x_dim1], &c__1, &x[m + 1 + (j
00962 + 1) * x_dim1], &c__1, &work[*n + j], &work[j]);
00963
00964 }
00965 }
00966
00967 }
00968
00969 i__3 = *kb - 1;
00970 for (k = 1; k <= i__3; ++k) {
00971
00972 i__4 = 1, i__1 = k - i0 + 2;
00973 j2 = i__ - k - 1 + max(i__4,i__1) * ka1;
00974
00975
00976
00977 for (l = *kb - k; l >= 1; --l) {
00978 nrt = (*n - j2 + l) / ka1;
00979 if (nrt > 0) {
00980 dlartv_(&nrt, &ab[ka1 - l + 1 + j2 * ab_dim1], &inca, &ab[
00981 ka1 - l + (j2 + 1) * ab_dim1], &inca, &work[*n +
00982 j2 - m], &work[j2 - m], &ka1);
00983 }
00984
00985 }
00986
00987 }
00988
00989 if (*kb > 1) {
00990 i__3 = i__ - *kb + (*ka << 1) + 1;
00991 for (j = *n - 1; j >= i__3; --j) {
00992 work[*n + j - m] = work[*n + j - *ka - m];
00993 work[j - m] = work[j - *ka - m];
00994
00995 }
00996 }
00997
00998 }
00999
01000 goto L10;
01001
01002 L480:
01003
01004
01005
01006
01007
01008
01009
01010
01011
01012
01013
01014
01015
01016
01017
01018
01019
01020 update = TRUE_;
01021 i__ = 0;
01022 L490:
01023 if (update) {
01024 ++i__;
01025
01026 i__3 = *kb, i__4 = m - i__;
01027 kbt = min(i__3,i__4);
01028 i0 = i__ + 1;
01029
01030 i__3 = 1, i__4 = i__ - *ka;
01031 i1 = max(i__3,i__4);
01032 i2 = i__ + kbt - ka1;
01033 if (i__ > m) {
01034 update = FALSE_;
01035 --i__;
01036 i0 = m + 1;
01037 if (*ka == 0) {
01038 return 0;
01039 }
01040 goto L490;
01041 }
01042 } else {
01043 i__ -= *ka;
01044 if (i__ < 2) {
01045 return 0;
01046 }
01047 }
01048
01049 if (i__ < m - kbt) {
01050 nx = m;
01051 } else {
01052 nx = *n;
01053 }
01054
01055 if (upper) {
01056
01057
01058
01059 if (update) {
01060
01061
01062
01063 bii = bb[kb1 + i__ * bb_dim1];
01064 i__3 = i__;
01065 for (j = i1; j <= i__3; ++j) {
01066 ab[j - i__ + ka1 + i__ * ab_dim1] /= bii;
01067
01068 }
01069
01070 i__4 = *n, i__1 = i__ + *ka;
01071 i__3 = min(i__4,i__1);
01072 for (j = i__; j <= i__3; ++j) {
01073 ab[i__ - j + ka1 + j * ab_dim1] /= bii;
01074
01075 }
01076 i__3 = i__ + kbt;
01077 for (k = i__ + 1; k <= i__3; ++k) {
01078 i__4 = i__ + kbt;
01079 for (j = k; j <= i__4; ++j) {
01080 ab[k - j + ka1 + j * ab_dim1] = ab[k - j + ka1 + j *
01081 ab_dim1] - bb[i__ - j + kb1 + j * bb_dim1] * ab[
01082 i__ - k + ka1 + k * ab_dim1] - bb[i__ - k + kb1 +
01083 k * bb_dim1] * ab[i__ - j + ka1 + j * ab_dim1] +
01084 ab[ka1 + i__ * ab_dim1] * bb[i__ - j + kb1 + j *
01085 bb_dim1] * bb[i__ - k + kb1 + k * bb_dim1];
01086
01087 }
01088
01089 i__1 = *n, i__2 = i__ + *ka;
01090 i__4 = min(i__1,i__2);
01091 for (j = i__ + kbt + 1; j <= i__4; ++j) {
01092 ab[k - j + ka1 + j * ab_dim1] -= bb[i__ - k + kb1 + k *
01093 bb_dim1] * ab[i__ - j + ka1 + j * ab_dim1];
01094
01095 }
01096
01097 }
01098 i__3 = i__;
01099 for (j = i1; j <= i__3; ++j) {
01100
01101 i__1 = j + *ka, i__2 = i__ + kbt;
01102 i__4 = min(i__1,i__2);
01103 for (k = i__ + 1; k <= i__4; ++k) {
01104 ab[j - k + ka1 + k * ab_dim1] -= bb[i__ - k + kb1 + k *
01105 bb_dim1] * ab[j - i__ + ka1 + i__ * ab_dim1];
01106
01107 }
01108
01109 }
01110
01111 if (wantx) {
01112
01113
01114
01115 d__1 = 1. / bii;
01116 dscal_(&nx, &d__1, &x[i__ * x_dim1 + 1], &c__1);
01117 if (kbt > 0) {
01118 i__3 = *ldbb - 1;
01119 dger_(&nx, &kbt, &c_b20, &x[i__ * x_dim1 + 1], &c__1, &bb[
01120 *kb + (i__ + 1) * bb_dim1], &i__3, &x[(i__ + 1) *
01121 x_dim1 + 1], ldx);
01122 }
01123 }
01124
01125
01126
01127 ra1 = ab[i1 - i__ + ka1 + i__ * ab_dim1];
01128 }
01129
01130
01131
01132
01133 i__3 = *kb - 1;
01134 for (k = 1; k <= i__3; ++k) {
01135 if (update) {
01136
01137
01138
01139
01140 if (i__ + k - ka1 > 0 && i__ + k < m) {
01141
01142
01143
01144 dlartg_(&ab[k + 1 + i__ * ab_dim1], &ra1, &work[*n + i__
01145 + k - *ka], &work[i__ + k - *ka], &ra);
01146
01147
01148
01149
01150 t = -bb[kb1 - k + (i__ + k) * bb_dim1] * ra1;
01151 work[m - *kb + i__ + k] = work[*n + i__ + k - *ka] * t -
01152 work[i__ + k - *ka] * ab[(i__ + k) * ab_dim1 + 1];
01153 ab[(i__ + k) * ab_dim1 + 1] = work[i__ + k - *ka] * t +
01154 work[*n + i__ + k - *ka] * ab[(i__ + k) * ab_dim1
01155 + 1];
01156 ra1 = ra;
01157 }
01158 }
01159
01160 i__4 = 1, i__1 = k + i0 - m + 1;
01161 j2 = i__ + k + 1 - max(i__4,i__1) * ka1;
01162 nr = (j2 + *ka - 1) / ka1;
01163 j1 = j2 - (nr - 1) * ka1;
01164 if (update) {
01165
01166 i__4 = j2, i__1 = i__ - (*ka << 1) + k - 1;
01167 j2t = min(i__4,i__1);
01168 } else {
01169 j2t = j2;
01170 }
01171 nrt = (j2t + *ka - 1) / ka1;
01172 i__4 = j2t;
01173 i__1 = ka1;
01174 for (j = j1; i__1 < 0 ? j >= i__4 : j <= i__4; j += i__1) {
01175
01176
01177
01178
01179 work[j] *= ab[(j + *ka - 1) * ab_dim1 + 1];
01180 ab[(j + *ka - 1) * ab_dim1 + 1] = work[*n + j] * ab[(j + *ka
01181 - 1) * ab_dim1 + 1];
01182
01183 }
01184
01185
01186
01187
01188 if (nrt > 0) {
01189 dlargv_(&nrt, &ab[(j1 + *ka) * ab_dim1 + 1], &inca, &work[j1],
01190 &ka1, &work[*n + j1], &ka1);
01191 }
01192 if (nr > 0) {
01193
01194
01195
01196 i__1 = *ka - 1;
01197 for (l = 1; l <= i__1; ++l) {
01198 dlartv_(&nr, &ab[ka1 - l + (j1 + l) * ab_dim1], &inca, &
01199 ab[*ka - l + (j1 + l) * ab_dim1], &inca, &work[*n
01200 + j1], &work[j1], &ka1);
01201
01202 }
01203
01204
01205
01206
01207 dlar2v_(&nr, &ab[ka1 + j1 * ab_dim1], &ab[ka1 + (j1 - 1) *
01208 ab_dim1], &ab[*ka + j1 * ab_dim1], &inca, &work[*n +
01209 j1], &work[j1], &ka1);
01210
01211 }
01212
01213
01214
01215 i__1 = *kb - k + 1;
01216 for (l = *ka - 1; l >= i__1; --l) {
01217 nrt = (j2 + l - 1) / ka1;
01218 j1t = j2 - (nrt - 1) * ka1;
01219 if (nrt > 0) {
01220 dlartv_(&nrt, &ab[l + j1t * ab_dim1], &inca, &ab[l + 1 + (
01221 j1t - 1) * ab_dim1], &inca, &work[*n + j1t], &
01222 work[j1t], &ka1);
01223 }
01224
01225 }
01226
01227 if (wantx) {
01228
01229
01230
01231 i__1 = j2;
01232 i__4 = ka1;
01233 for (j = j1; i__4 < 0 ? j >= i__1 : j <= i__1; j += i__4) {
01234 drot_(&nx, &x[j * x_dim1 + 1], &c__1, &x[(j - 1) * x_dim1
01235 + 1], &c__1, &work[*n + j], &work[j]);
01236
01237 }
01238 }
01239
01240 }
01241
01242 if (update) {
01243 if (i2 > 0 && kbt > 0) {
01244
01245
01246
01247
01248 work[m - *kb + i__ + kbt] = -bb[kb1 - kbt + (i__ + kbt) *
01249 bb_dim1] * ra1;
01250 }
01251 }
01252
01253 for (k = *kb; k >= 1; --k) {
01254 if (update) {
01255
01256 i__3 = 2, i__4 = k + i0 - m;
01257 j2 = i__ + k + 1 - max(i__3,i__4) * ka1;
01258 } else {
01259
01260 i__3 = 1, i__4 = k + i0 - m;
01261 j2 = i__ + k + 1 - max(i__3,i__4) * ka1;
01262 }
01263
01264
01265
01266 for (l = *kb - k; l >= 1; --l) {
01267 nrt = (j2 + *ka + l - 1) / ka1;
01268 j1t = j2 - (nrt - 1) * ka1;
01269 if (nrt > 0) {
01270 dlartv_(&nrt, &ab[l + (j1t + *ka) * ab_dim1], &inca, &ab[
01271 l + 1 + (j1t + *ka - 1) * ab_dim1], &inca, &work[*
01272 n + m - *kb + j1t + *ka], &work[m - *kb + j1t + *
01273 ka], &ka1);
01274 }
01275
01276 }
01277 nr = (j2 + *ka - 1) / ka1;
01278 j1 = j2 - (nr - 1) * ka1;
01279 i__3 = j2;
01280 i__4 = ka1;
01281 for (j = j1; i__4 < 0 ? j >= i__3 : j <= i__3; j += i__4) {
01282 work[m - *kb + j] = work[m - *kb + j + *ka];
01283 work[*n + m - *kb + j] = work[*n + m - *kb + j + *ka];
01284
01285 }
01286 i__4 = j2;
01287 i__3 = ka1;
01288 for (j = j1; i__3 < 0 ? j >= i__4 : j <= i__4; j += i__3) {
01289
01290
01291
01292
01293 work[m - *kb + j] *= ab[(j + *ka - 1) * ab_dim1 + 1];
01294 ab[(j + *ka - 1) * ab_dim1 + 1] = work[*n + m - *kb + j] * ab[
01295 (j + *ka - 1) * ab_dim1 + 1];
01296
01297 }
01298 if (update) {
01299 if (i__ + k > ka1 && k <= kbt) {
01300 work[m - *kb + i__ + k - *ka] = work[m - *kb + i__ + k];
01301 }
01302 }
01303
01304 }
01305
01306 for (k = *kb; k >= 1; --k) {
01307
01308 i__3 = 1, i__4 = k + i0 - m;
01309 j2 = i__ + k + 1 - max(i__3,i__4) * ka1;
01310 nr = (j2 + *ka - 1) / ka1;
01311 j1 = j2 - (nr - 1) * ka1;
01312 if (nr > 0) {
01313
01314
01315
01316
01317 dlargv_(&nr, &ab[(j1 + *ka) * ab_dim1 + 1], &inca, &work[m - *
01318 kb + j1], &ka1, &work[*n + m - *kb + j1], &ka1);
01319
01320
01321
01322 i__3 = *ka - 1;
01323 for (l = 1; l <= i__3; ++l) {
01324 dlartv_(&nr, &ab[ka1 - l + (j1 + l) * ab_dim1], &inca, &
01325 ab[*ka - l + (j1 + l) * ab_dim1], &inca, &work[*n
01326 + m - *kb + j1], &work[m - *kb + j1], &ka1);
01327
01328 }
01329
01330
01331
01332
01333 dlar2v_(&nr, &ab[ka1 + j1 * ab_dim1], &ab[ka1 + (j1 - 1) *
01334 ab_dim1], &ab[*ka + j1 * ab_dim1], &inca, &work[*n +
01335 m - *kb + j1], &work[m - *kb + j1], &ka1);
01336
01337 }
01338
01339
01340
01341 i__3 = *kb - k + 1;
01342 for (l = *ka - 1; l >= i__3; --l) {
01343 nrt = (j2 + l - 1) / ka1;
01344 j1t = j2 - (nrt - 1) * ka1;
01345 if (nrt > 0) {
01346 dlartv_(&nrt, &ab[l + j1t * ab_dim1], &inca, &ab[l + 1 + (
01347 j1t - 1) * ab_dim1], &inca, &work[*n + m - *kb +
01348 j1t], &work[m - *kb + j1t], &ka1);
01349 }
01350
01351 }
01352
01353 if (wantx) {
01354
01355
01356
01357 i__3 = j2;
01358 i__4 = ka1;
01359 for (j = j1; i__4 < 0 ? j >= i__3 : j <= i__3; j += i__4) {
01360 drot_(&nx, &x[j * x_dim1 + 1], &c__1, &x[(j - 1) * x_dim1
01361 + 1], &c__1, &work[*n + m - *kb + j], &work[m - *
01362 kb + j]);
01363
01364 }
01365 }
01366
01367 }
01368
01369 i__4 = *kb - 1;
01370 for (k = 1; k <= i__4; ++k) {
01371
01372 i__3 = 1, i__1 = k + i0 - m + 1;
01373 j2 = i__ + k + 1 - max(i__3,i__1) * ka1;
01374
01375
01376
01377 for (l = *kb - k; l >= 1; --l) {
01378 nrt = (j2 + l - 1) / ka1;
01379 j1t = j2 - (nrt - 1) * ka1;
01380 if (nrt > 0) {
01381 dlartv_(&nrt, &ab[l + j1t * ab_dim1], &inca, &ab[l + 1 + (
01382 j1t - 1) * ab_dim1], &inca, &work[*n + j1t], &
01383 work[j1t], &ka1);
01384 }
01385
01386 }
01387
01388 }
01389
01390 if (*kb > 1) {
01391
01392 i__3 = i__ + *kb;
01393 i__4 = min(i__3,m) - (*ka << 1) - 1;
01394 for (j = 2; j <= i__4; ++j) {
01395 work[*n + j] = work[*n + j + *ka];
01396 work[j] = work[j + *ka];
01397
01398 }
01399 }
01400
01401 } else {
01402
01403
01404
01405 if (update) {
01406
01407
01408
01409 bii = bb[i__ * bb_dim1 + 1];
01410 i__4 = i__;
01411 for (j = i1; j <= i__4; ++j) {
01412 ab[i__ - j + 1 + j * ab_dim1] /= bii;
01413
01414 }
01415
01416 i__3 = *n, i__1 = i__ + *ka;
01417 i__4 = min(i__3,i__1);
01418 for (j = i__; j <= i__4; ++j) {
01419 ab[j - i__ + 1 + i__ * ab_dim1] /= bii;
01420
01421 }
01422 i__4 = i__ + kbt;
01423 for (k = i__ + 1; k <= i__4; ++k) {
01424 i__3 = i__ + kbt;
01425 for (j = k; j <= i__3; ++j) {
01426 ab[j - k + 1 + k * ab_dim1] = ab[j - k + 1 + k * ab_dim1]
01427 - bb[j - i__ + 1 + i__ * bb_dim1] * ab[k - i__ +
01428 1 + i__ * ab_dim1] - bb[k - i__ + 1 + i__ *
01429 bb_dim1] * ab[j - i__ + 1 + i__ * ab_dim1] + ab[
01430 i__ * ab_dim1 + 1] * bb[j - i__ + 1 + i__ *
01431 bb_dim1] * bb[k - i__ + 1 + i__ * bb_dim1];
01432
01433 }
01434
01435 i__1 = *n, i__2 = i__ + *ka;
01436 i__3 = min(i__1,i__2);
01437 for (j = i__ + kbt + 1; j <= i__3; ++j) {
01438 ab[j - k + 1 + k * ab_dim1] -= bb[k - i__ + 1 + i__ *
01439 bb_dim1] * ab[j - i__ + 1 + i__ * ab_dim1];
01440
01441 }
01442
01443 }
01444 i__4 = i__;
01445 for (j = i1; j <= i__4; ++j) {
01446
01447 i__1 = j + *ka, i__2 = i__ + kbt;
01448 i__3 = min(i__1,i__2);
01449 for (k = i__ + 1; k <= i__3; ++k) {
01450 ab[k - j + 1 + j * ab_dim1] -= bb[k - i__ + 1 + i__ *
01451 bb_dim1] * ab[i__ - j + 1 + j * ab_dim1];
01452
01453 }
01454
01455 }
01456
01457 if (wantx) {
01458
01459
01460
01461 d__1 = 1. / bii;
01462 dscal_(&nx, &d__1, &x[i__ * x_dim1 + 1], &c__1);
01463 if (kbt > 0) {
01464 dger_(&nx, &kbt, &c_b20, &x[i__ * x_dim1 + 1], &c__1, &bb[
01465 i__ * bb_dim1 + 2], &c__1, &x[(i__ + 1) * x_dim1
01466 + 1], ldx);
01467 }
01468 }
01469
01470
01471
01472 ra1 = ab[i__ - i1 + 1 + i1 * ab_dim1];
01473 }
01474
01475
01476
01477
01478 i__4 = *kb - 1;
01479 for (k = 1; k <= i__4; ++k) {
01480 if (update) {
01481
01482
01483
01484
01485 if (i__ + k - ka1 > 0 && i__ + k < m) {
01486
01487
01488
01489 dlartg_(&ab[ka1 - k + (i__ + k - *ka) * ab_dim1], &ra1, &
01490 work[*n + i__ + k - *ka], &work[i__ + k - *ka], &
01491 ra);
01492
01493
01494
01495
01496 t = -bb[k + 1 + i__ * bb_dim1] * ra1;
01497 work[m - *kb + i__ + k] = work[*n + i__ + k - *ka] * t -
01498 work[i__ + k - *ka] * ab[ka1 + (i__ + k - *ka) *
01499 ab_dim1];
01500 ab[ka1 + (i__ + k - *ka) * ab_dim1] = work[i__ + k - *ka]
01501 * t + work[*n + i__ + k - *ka] * ab[ka1 + (i__ +
01502 k - *ka) * ab_dim1];
01503 ra1 = ra;
01504 }
01505 }
01506
01507 i__3 = 1, i__1 = k + i0 - m + 1;
01508 j2 = i__ + k + 1 - max(i__3,i__1) * ka1;
01509 nr = (j2 + *ka - 1) / ka1;
01510 j1 = j2 - (nr - 1) * ka1;
01511 if (update) {
01512
01513 i__3 = j2, i__1 = i__ - (*ka << 1) + k - 1;
01514 j2t = min(i__3,i__1);
01515 } else {
01516 j2t = j2;
01517 }
01518 nrt = (j2t + *ka - 1) / ka1;
01519 i__3 = j2t;
01520 i__1 = ka1;
01521 for (j = j1; i__1 < 0 ? j >= i__3 : j <= i__3; j += i__1) {
01522
01523
01524
01525
01526 work[j] *= ab[ka1 + (j - 1) * ab_dim1];
01527 ab[ka1 + (j - 1) * ab_dim1] = work[*n + j] * ab[ka1 + (j - 1)
01528 * ab_dim1];
01529
01530 }
01531
01532
01533
01534
01535 if (nrt > 0) {
01536 dlargv_(&nrt, &ab[ka1 + j1 * ab_dim1], &inca, &work[j1], &ka1,
01537 &work[*n + j1], &ka1);
01538 }
01539 if (nr > 0) {
01540
01541
01542
01543 i__1 = *ka - 1;
01544 for (l = 1; l <= i__1; ++l) {
01545 dlartv_(&nr, &ab[l + 1 + j1 * ab_dim1], &inca, &ab[l + 2
01546 + (j1 - 1) * ab_dim1], &inca, &work[*n + j1], &
01547 work[j1], &ka1);
01548
01549 }
01550
01551
01552
01553
01554 dlar2v_(&nr, &ab[j1 * ab_dim1 + 1], &ab[(j1 - 1) * ab_dim1 +
01555 1], &ab[(j1 - 1) * ab_dim1 + 2], &inca, &work[*n + j1]
01556 , &work[j1], &ka1);
01557
01558 }
01559
01560
01561
01562 i__1 = *kb - k + 1;
01563 for (l = *ka - 1; l >= i__1; --l) {
01564 nrt = (j2 + l - 1) / ka1;
01565 j1t = j2 - (nrt - 1) * ka1;
01566 if (nrt > 0) {
01567 dlartv_(&nrt, &ab[ka1 - l + 1 + (j1t - ka1 + l) * ab_dim1]
01568 , &inca, &ab[ka1 - l + (j1t - ka1 + l) * ab_dim1],
01569 &inca, &work[*n + j1t], &work[j1t], &ka1);
01570 }
01571
01572 }
01573
01574 if (wantx) {
01575
01576
01577
01578 i__1 = j2;
01579 i__3 = ka1;
01580 for (j = j1; i__3 < 0 ? j >= i__1 : j <= i__1; j += i__3) {
01581 drot_(&nx, &x[j * x_dim1 + 1], &c__1, &x[(j - 1) * x_dim1
01582 + 1], &c__1, &work[*n + j], &work[j]);
01583
01584 }
01585 }
01586
01587 }
01588
01589 if (update) {
01590 if (i2 > 0 && kbt > 0) {
01591
01592
01593
01594
01595 work[m - *kb + i__ + kbt] = -bb[kbt + 1 + i__ * bb_dim1] *
01596 ra1;
01597 }
01598 }
01599
01600 for (k = *kb; k >= 1; --k) {
01601 if (update) {
01602
01603 i__4 = 2, i__3 = k + i0 - m;
01604 j2 = i__ + k + 1 - max(i__4,i__3) * ka1;
01605 } else {
01606
01607 i__4 = 1, i__3 = k + i0 - m;
01608 j2 = i__ + k + 1 - max(i__4,i__3) * ka1;
01609 }
01610
01611
01612
01613 for (l = *kb - k; l >= 1; --l) {
01614 nrt = (j2 + *ka + l - 1) / ka1;
01615 j1t = j2 - (nrt - 1) * ka1;
01616 if (nrt > 0) {
01617 dlartv_(&nrt, &ab[ka1 - l + 1 + (j1t + l - 1) * ab_dim1],
01618 &inca, &ab[ka1 - l + (j1t + l - 1) * ab_dim1], &
01619 inca, &work[*n + m - *kb + j1t + *ka], &work[m - *
01620 kb + j1t + *ka], &ka1);
01621 }
01622
01623 }
01624 nr = (j2 + *ka - 1) / ka1;
01625 j1 = j2 - (nr - 1) * ka1;
01626 i__4 = j2;
01627 i__3 = ka1;
01628 for (j = j1; i__3 < 0 ? j >= i__4 : j <= i__4; j += i__3) {
01629 work[m - *kb + j] = work[m - *kb + j + *ka];
01630 work[*n + m - *kb + j] = work[*n + m - *kb + j + *ka];
01631
01632 }
01633 i__3 = j2;
01634 i__4 = ka1;
01635 for (j = j1; i__4 < 0 ? j >= i__3 : j <= i__3; j += i__4) {
01636
01637
01638
01639
01640 work[m - *kb + j] *= ab[ka1 + (j - 1) * ab_dim1];
01641 ab[ka1 + (j - 1) * ab_dim1] = work[*n + m - *kb + j] * ab[ka1
01642 + (j - 1) * ab_dim1];
01643
01644 }
01645 if (update) {
01646 if (i__ + k > ka1 && k <= kbt) {
01647 work[m - *kb + i__ + k - *ka] = work[m - *kb + i__ + k];
01648 }
01649 }
01650
01651 }
01652
01653 for (k = *kb; k >= 1; --k) {
01654
01655 i__4 = 1, i__3 = k + i0 - m;
01656 j2 = i__ + k + 1 - max(i__4,i__3) * ka1;
01657 nr = (j2 + *ka - 1) / ka1;
01658 j1 = j2 - (nr - 1) * ka1;
01659 if (nr > 0) {
01660
01661
01662
01663
01664 dlargv_(&nr, &ab[ka1 + j1 * ab_dim1], &inca, &work[m - *kb +
01665 j1], &ka1, &work[*n + m - *kb + j1], &ka1);
01666
01667
01668
01669 i__4 = *ka - 1;
01670 for (l = 1; l <= i__4; ++l) {
01671 dlartv_(&nr, &ab[l + 1 + j1 * ab_dim1], &inca, &ab[l + 2
01672 + (j1 - 1) * ab_dim1], &inca, &work[*n + m - *kb
01673 + j1], &work[m - *kb + j1], &ka1);
01674
01675 }
01676
01677
01678
01679
01680 dlar2v_(&nr, &ab[j1 * ab_dim1 + 1], &ab[(j1 - 1) * ab_dim1 +
01681 1], &ab[(j1 - 1) * ab_dim1 + 2], &inca, &work[*n + m
01682 - *kb + j1], &work[m - *kb + j1], &ka1);
01683
01684 }
01685
01686
01687
01688 i__4 = *kb - k + 1;
01689 for (l = *ka - 1; l >= i__4; --l) {
01690 nrt = (j2 + l - 1) / ka1;
01691 j1t = j2 - (nrt - 1) * ka1;
01692 if (nrt > 0) {
01693 dlartv_(&nrt, &ab[ka1 - l + 1 + (j1t - ka1 + l) * ab_dim1]
01694 , &inca, &ab[ka1 - l + (j1t - ka1 + l) * ab_dim1],
01695 &inca, &work[*n + m - *kb + j1t], &work[m - *kb
01696 + j1t], &ka1);
01697 }
01698
01699 }
01700
01701 if (wantx) {
01702
01703
01704
01705 i__4 = j2;
01706 i__3 = ka1;
01707 for (j = j1; i__3 < 0 ? j >= i__4 : j <= i__4; j += i__3) {
01708 drot_(&nx, &x[j * x_dim1 + 1], &c__1, &x[(j - 1) * x_dim1
01709 + 1], &c__1, &work[*n + m - *kb + j], &work[m - *
01710 kb + j]);
01711
01712 }
01713 }
01714
01715 }
01716
01717 i__3 = *kb - 1;
01718 for (k = 1; k <= i__3; ++k) {
01719
01720 i__4 = 1, i__1 = k + i0 - m + 1;
01721 j2 = i__ + k + 1 - max(i__4,i__1) * ka1;
01722
01723
01724
01725 for (l = *kb - k; l >= 1; --l) {
01726 nrt = (j2 + l - 1) / ka1;
01727 j1t = j2 - (nrt - 1) * ka1;
01728 if (nrt > 0) {
01729 dlartv_(&nrt, &ab[ka1 - l + 1 + (j1t - ka1 + l) * ab_dim1]
01730 , &inca, &ab[ka1 - l + (j1t - ka1 + l) * ab_dim1],
01731 &inca, &work[*n + j1t], &work[j1t], &ka1);
01732 }
01733
01734 }
01735
01736 }
01737
01738 if (*kb > 1) {
01739
01740 i__4 = i__ + *kb;
01741 i__3 = min(i__4,m) - (*ka << 1) - 1;
01742 for (j = 2; j <= i__3; ++j) {
01743 work[*n + j] = work[*n + j + *ka];
01744 work[j] = work[j + *ka];
01745
01746 }
01747 }
01748
01749 }
01750
01751 goto L490;
01752
01753
01754
01755 }