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