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 logical c_false = FALSE_;
00019 static integer c__1 = 1;
00020 static real c_b22 = 1.f;
00021 static real c_b25 = 0.f;
00022 static integer c__2 = 2;
00023 static logical c_true = TRUE_;
00024
00025 int strevc_(char *side, char *howmny, logical *select,
00026 integer *n, real *t, integer *ldt, real *vl, integer *ldvl, real *vr,
00027 integer *ldvr, integer *mm, integer *m, real *work, integer *info)
00028 {
00029
00030 integer t_dim1, t_offset, vl_dim1, vl_offset, vr_dim1, vr_offset, i__1,
00031 i__2, i__3;
00032 real r__1, r__2, r__3, r__4;
00033
00034
00035 double sqrt(doublereal);
00036
00037
00038 integer i__, j, k;
00039 real x[4] ;
00040 integer j1, j2, n2, ii, ki, ip, is;
00041 real wi, wr, rec, ulp, beta, emax;
00042 logical pair, allv;
00043 integer ierr;
00044 real unfl, ovfl, smin;
00045 extern doublereal sdot_(integer *, real *, integer *, real *, integer *);
00046 logical over;
00047 real vmax;
00048 integer jnxt;
00049 real scale;
00050 extern logical lsame_(char *, char *);
00051 extern int sscal_(integer *, real *, real *, integer *);
00052 real remax;
00053 logical leftv;
00054 extern int sgemv_(char *, integer *, integer *, real *,
00055 real *, integer *, real *, integer *, real *, real *, integer *);
00056 logical bothv;
00057 real vcrit;
00058 logical somev;
00059 extern int scopy_(integer *, real *, integer *, real *,
00060 integer *);
00061 real xnorm;
00062 extern int saxpy_(integer *, real *, real *, integer *,
00063 real *, integer *), slaln2_(logical *, integer *, integer *, real
00064 *, real *, real *, integer *, real *, real *, real *, integer *,
00065 real *, real *, real *, integer *, real *, real *, integer *),
00066 slabad_(real *, real *);
00067 extern doublereal slamch_(char *);
00068 extern int xerbla_(char *, integer *);
00069 real bignum;
00070 extern integer isamax_(integer *, real *, integer *);
00071 logical rightv;
00072 real smlnum;
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
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229 --select;
00230 t_dim1 = *ldt;
00231 t_offset = 1 + t_dim1;
00232 t -= t_offset;
00233 vl_dim1 = *ldvl;
00234 vl_offset = 1 + vl_dim1;
00235 vl -= vl_offset;
00236 vr_dim1 = *ldvr;
00237 vr_offset = 1 + vr_dim1;
00238 vr -= vr_offset;
00239 --work;
00240
00241
00242 bothv = lsame_(side, "B");
00243 rightv = lsame_(side, "R") || bothv;
00244 leftv = lsame_(side, "L") || bothv;
00245
00246 allv = lsame_(howmny, "A");
00247 over = lsame_(howmny, "B");
00248 somev = lsame_(howmny, "S");
00249
00250 *info = 0;
00251 if (! rightv && ! leftv) {
00252 *info = -1;
00253 } else if (! allv && ! over && ! somev) {
00254 *info = -2;
00255 } else if (*n < 0) {
00256 *info = -4;
00257 } else if (*ldt < max(1,*n)) {
00258 *info = -6;
00259 } else if (*ldvl < 1 || leftv && *ldvl < *n) {
00260 *info = -8;
00261 } else if (*ldvr < 1 || rightv && *ldvr < *n) {
00262 *info = -10;
00263 } else {
00264
00265
00266
00267
00268
00269 if (somev) {
00270 *m = 0;
00271 pair = FALSE_;
00272 i__1 = *n;
00273 for (j = 1; j <= i__1; ++j) {
00274 if (pair) {
00275 pair = FALSE_;
00276 select[j] = FALSE_;
00277 } else {
00278 if (j < *n) {
00279 if (t[j + 1 + j * t_dim1] == 0.f) {
00280 if (select[j]) {
00281 ++(*m);
00282 }
00283 } else {
00284 pair = TRUE_;
00285 if (select[j] || select[j + 1]) {
00286 select[j] = TRUE_;
00287 *m += 2;
00288 }
00289 }
00290 } else {
00291 if (select[*n]) {
00292 ++(*m);
00293 }
00294 }
00295 }
00296
00297 }
00298 } else {
00299 *m = *n;
00300 }
00301
00302 if (*mm < *m) {
00303 *info = -11;
00304 }
00305 }
00306 if (*info != 0) {
00307 i__1 = -(*info);
00308 xerbla_("STREVC", &i__1);
00309 return 0;
00310 }
00311
00312
00313
00314 if (*n == 0) {
00315 return 0;
00316 }
00317
00318
00319
00320 unfl = slamch_("Safe minimum");
00321 ovfl = 1.f / unfl;
00322 slabad_(&unfl, &ovfl);
00323 ulp = slamch_("Precision");
00324 smlnum = unfl * (*n / ulp);
00325 bignum = (1.f - ulp) / smlnum;
00326
00327
00328
00329
00330 work[1] = 0.f;
00331 i__1 = *n;
00332 for (j = 2; j <= i__1; ++j) {
00333 work[j] = 0.f;
00334 i__2 = j - 1;
00335 for (i__ = 1; i__ <= i__2; ++i__) {
00336 work[j] += (r__1 = t[i__ + j * t_dim1], dabs(r__1));
00337
00338 }
00339
00340 }
00341
00342
00343
00344
00345
00346
00347 n2 = *n << 1;
00348
00349 if (rightv) {
00350
00351
00352
00353 ip = 0;
00354 is = *m;
00355 for (ki = *n; ki >= 1; --ki) {
00356
00357 if (ip == 1) {
00358 goto L130;
00359 }
00360 if (ki == 1) {
00361 goto L40;
00362 }
00363 if (t[ki + (ki - 1) * t_dim1] == 0.f) {
00364 goto L40;
00365 }
00366 ip = -1;
00367
00368 L40:
00369 if (somev) {
00370 if (ip == 0) {
00371 if (! select[ki]) {
00372 goto L130;
00373 }
00374 } else {
00375 if (! select[ki - 1]) {
00376 goto L130;
00377 }
00378 }
00379 }
00380
00381
00382
00383 wr = t[ki + ki * t_dim1];
00384 wi = 0.f;
00385 if (ip != 0) {
00386 wi = sqrt((r__1 = t[ki + (ki - 1) * t_dim1], dabs(r__1))) *
00387 sqrt((r__2 = t[ki - 1 + ki * t_dim1], dabs(r__2)));
00388 }
00389
00390 r__1 = ulp * (dabs(wr) + dabs(wi));
00391 smin = dmax(r__1,smlnum);
00392
00393 if (ip == 0) {
00394
00395
00396
00397 work[ki + *n] = 1.f;
00398
00399
00400
00401 i__1 = ki - 1;
00402 for (k = 1; k <= i__1; ++k) {
00403 work[k + *n] = -t[k + ki * t_dim1];
00404
00405 }
00406
00407
00408
00409
00410 jnxt = ki - 1;
00411 for (j = ki - 1; j >= 1; --j) {
00412 if (j > jnxt) {
00413 goto L60;
00414 }
00415 j1 = j;
00416 j2 = j;
00417 jnxt = j - 1;
00418 if (j > 1) {
00419 if (t[j + (j - 1) * t_dim1] != 0.f) {
00420 j1 = j - 1;
00421 jnxt = j - 2;
00422 }
00423 }
00424
00425 if (j1 == j2) {
00426
00427
00428
00429 slaln2_(&c_false, &c__1, &c__1, &smin, &c_b22, &t[j +
00430 j * t_dim1], ldt, &c_b22, &c_b22, &work[j + *
00431 n], n, &wr, &c_b25, x, &c__2, &scale, &xnorm,
00432 &ierr);
00433
00434
00435
00436
00437 if (xnorm > 1.f) {
00438 if (work[j] > bignum / xnorm) {
00439 x[0] /= xnorm;
00440 scale /= xnorm;
00441 }
00442 }
00443
00444
00445
00446 if (scale != 1.f) {
00447 sscal_(&ki, &scale, &work[*n + 1], &c__1);
00448 }
00449 work[j + *n] = x[0];
00450
00451
00452
00453 i__1 = j - 1;
00454 r__1 = -x[0];
00455 saxpy_(&i__1, &r__1, &t[j * t_dim1 + 1], &c__1, &work[
00456 *n + 1], &c__1);
00457
00458 } else {
00459
00460
00461
00462 slaln2_(&c_false, &c__2, &c__1, &smin, &c_b22, &t[j -
00463 1 + (j - 1) * t_dim1], ldt, &c_b22, &c_b22, &
00464 work[j - 1 + *n], n, &wr, &c_b25, x, &c__2, &
00465 scale, &xnorm, &ierr);
00466
00467
00468
00469
00470 if (xnorm > 1.f) {
00471
00472 r__1 = work[j - 1], r__2 = work[j];
00473 beta = dmax(r__1,r__2);
00474 if (beta > bignum / xnorm) {
00475 x[0] /= xnorm;
00476 x[1] /= xnorm;
00477 scale /= xnorm;
00478 }
00479 }
00480
00481
00482
00483 if (scale != 1.f) {
00484 sscal_(&ki, &scale, &work[*n + 1], &c__1);
00485 }
00486 work[j - 1 + *n] = x[0];
00487 work[j + *n] = x[1];
00488
00489
00490
00491 i__1 = j - 2;
00492 r__1 = -x[0];
00493 saxpy_(&i__1, &r__1, &t[(j - 1) * t_dim1 + 1], &c__1,
00494 &work[*n + 1], &c__1);
00495 i__1 = j - 2;
00496 r__1 = -x[1];
00497 saxpy_(&i__1, &r__1, &t[j * t_dim1 + 1], &c__1, &work[
00498 *n + 1], &c__1);
00499 }
00500 L60:
00501 ;
00502 }
00503
00504
00505
00506 if (! over) {
00507 scopy_(&ki, &work[*n + 1], &c__1, &vr[is * vr_dim1 + 1], &
00508 c__1);
00509
00510 ii = isamax_(&ki, &vr[is * vr_dim1 + 1], &c__1);
00511 remax = 1.f / (r__1 = vr[ii + is * vr_dim1], dabs(r__1));
00512 sscal_(&ki, &remax, &vr[is * vr_dim1 + 1], &c__1);
00513
00514 i__1 = *n;
00515 for (k = ki + 1; k <= i__1; ++k) {
00516 vr[k + is * vr_dim1] = 0.f;
00517
00518 }
00519 } else {
00520 if (ki > 1) {
00521 i__1 = ki - 1;
00522 sgemv_("N", n, &i__1, &c_b22, &vr[vr_offset], ldvr, &
00523 work[*n + 1], &c__1, &work[ki + *n], &vr[ki *
00524 vr_dim1 + 1], &c__1);
00525 }
00526
00527 ii = isamax_(n, &vr[ki * vr_dim1 + 1], &c__1);
00528 remax = 1.f / (r__1 = vr[ii + ki * vr_dim1], dabs(r__1));
00529 sscal_(n, &remax, &vr[ki * vr_dim1 + 1], &c__1);
00530 }
00531
00532 } else {
00533
00534
00535
00536
00537
00538
00539
00540 if ((r__1 = t[ki - 1 + ki * t_dim1], dabs(r__1)) >= (r__2 = t[
00541 ki + (ki - 1) * t_dim1], dabs(r__2))) {
00542 work[ki - 1 + *n] = 1.f;
00543 work[ki + n2] = wi / t[ki - 1 + ki * t_dim1];
00544 } else {
00545 work[ki - 1 + *n] = -wi / t[ki + (ki - 1) * t_dim1];
00546 work[ki + n2] = 1.f;
00547 }
00548 work[ki + *n] = 0.f;
00549 work[ki - 1 + n2] = 0.f;
00550
00551
00552
00553 i__1 = ki - 2;
00554 for (k = 1; k <= i__1; ++k) {
00555 work[k + *n] = -work[ki - 1 + *n] * t[k + (ki - 1) *
00556 t_dim1];
00557 work[k + n2] = -work[ki + n2] * t[k + ki * t_dim1];
00558
00559 }
00560
00561
00562
00563
00564 jnxt = ki - 2;
00565 for (j = ki - 2; j >= 1; --j) {
00566 if (j > jnxt) {
00567 goto L90;
00568 }
00569 j1 = j;
00570 j2 = j;
00571 jnxt = j - 1;
00572 if (j > 1) {
00573 if (t[j + (j - 1) * t_dim1] != 0.f) {
00574 j1 = j - 1;
00575 jnxt = j - 2;
00576 }
00577 }
00578
00579 if (j1 == j2) {
00580
00581
00582
00583 slaln2_(&c_false, &c__1, &c__2, &smin, &c_b22, &t[j +
00584 j * t_dim1], ldt, &c_b22, &c_b22, &work[j + *
00585 n], n, &wr, &wi, x, &c__2, &scale, &xnorm, &
00586 ierr);
00587
00588
00589
00590
00591 if (xnorm > 1.f) {
00592 if (work[j] > bignum / xnorm) {
00593 x[0] /= xnorm;
00594 x[2] /= xnorm;
00595 scale /= xnorm;
00596 }
00597 }
00598
00599
00600
00601 if (scale != 1.f) {
00602 sscal_(&ki, &scale, &work[*n + 1], &c__1);
00603 sscal_(&ki, &scale, &work[n2 + 1], &c__1);
00604 }
00605 work[j + *n] = x[0];
00606 work[j + n2] = x[2];
00607
00608
00609
00610 i__1 = j - 1;
00611 r__1 = -x[0];
00612 saxpy_(&i__1, &r__1, &t[j * t_dim1 + 1], &c__1, &work[
00613 *n + 1], &c__1);
00614 i__1 = j - 1;
00615 r__1 = -x[2];
00616 saxpy_(&i__1, &r__1, &t[j * t_dim1 + 1], &c__1, &work[
00617 n2 + 1], &c__1);
00618
00619 } else {
00620
00621
00622
00623 slaln2_(&c_false, &c__2, &c__2, &smin, &c_b22, &t[j -
00624 1 + (j - 1) * t_dim1], ldt, &c_b22, &c_b22, &
00625 work[j - 1 + *n], n, &wr, &wi, x, &c__2, &
00626 scale, &xnorm, &ierr);
00627
00628
00629
00630
00631 if (xnorm > 1.f) {
00632
00633 r__1 = work[j - 1], r__2 = work[j];
00634 beta = dmax(r__1,r__2);
00635 if (beta > bignum / xnorm) {
00636 rec = 1.f / xnorm;
00637 x[0] *= rec;
00638 x[2] *= rec;
00639 x[1] *= rec;
00640 x[3] *= rec;
00641 scale *= rec;
00642 }
00643 }
00644
00645
00646
00647 if (scale != 1.f) {
00648 sscal_(&ki, &scale, &work[*n + 1], &c__1);
00649 sscal_(&ki, &scale, &work[n2 + 1], &c__1);
00650 }
00651 work[j - 1 + *n] = x[0];
00652 work[j + *n] = x[1];
00653 work[j - 1 + n2] = x[2];
00654 work[j + n2] = x[3];
00655
00656
00657
00658 i__1 = j - 2;
00659 r__1 = -x[0];
00660 saxpy_(&i__1, &r__1, &t[(j - 1) * t_dim1 + 1], &c__1,
00661 &work[*n + 1], &c__1);
00662 i__1 = j - 2;
00663 r__1 = -x[1];
00664 saxpy_(&i__1, &r__1, &t[j * t_dim1 + 1], &c__1, &work[
00665 *n + 1], &c__1);
00666 i__1 = j - 2;
00667 r__1 = -x[2];
00668 saxpy_(&i__1, &r__1, &t[(j - 1) * t_dim1 + 1], &c__1,
00669 &work[n2 + 1], &c__1);
00670 i__1 = j - 2;
00671 r__1 = -x[3];
00672 saxpy_(&i__1, &r__1, &t[j * t_dim1 + 1], &c__1, &work[
00673 n2 + 1], &c__1);
00674 }
00675 L90:
00676 ;
00677 }
00678
00679
00680
00681 if (! over) {
00682 scopy_(&ki, &work[*n + 1], &c__1, &vr[(is - 1) * vr_dim1
00683 + 1], &c__1);
00684 scopy_(&ki, &work[n2 + 1], &c__1, &vr[is * vr_dim1 + 1], &
00685 c__1);
00686
00687 emax = 0.f;
00688 i__1 = ki;
00689 for (k = 1; k <= i__1; ++k) {
00690
00691 r__3 = emax, r__4 = (r__1 = vr[k + (is - 1) * vr_dim1]
00692 , dabs(r__1)) + (r__2 = vr[k + is * vr_dim1],
00693 dabs(r__2));
00694 emax = dmax(r__3,r__4);
00695
00696 }
00697
00698 remax = 1.f / emax;
00699 sscal_(&ki, &remax, &vr[(is - 1) * vr_dim1 + 1], &c__1);
00700 sscal_(&ki, &remax, &vr[is * vr_dim1 + 1], &c__1);
00701
00702 i__1 = *n;
00703 for (k = ki + 1; k <= i__1; ++k) {
00704 vr[k + (is - 1) * vr_dim1] = 0.f;
00705 vr[k + is * vr_dim1] = 0.f;
00706
00707 }
00708
00709 } else {
00710
00711 if (ki > 2) {
00712 i__1 = ki - 2;
00713 sgemv_("N", n, &i__1, &c_b22, &vr[vr_offset], ldvr, &
00714 work[*n + 1], &c__1, &work[ki - 1 + *n], &vr[(
00715 ki - 1) * vr_dim1 + 1], &c__1);
00716 i__1 = ki - 2;
00717 sgemv_("N", n, &i__1, &c_b22, &vr[vr_offset], ldvr, &
00718 work[n2 + 1], &c__1, &work[ki + n2], &vr[ki *
00719 vr_dim1 + 1], &c__1);
00720 } else {
00721 sscal_(n, &work[ki - 1 + *n], &vr[(ki - 1) * vr_dim1
00722 + 1], &c__1);
00723 sscal_(n, &work[ki + n2], &vr[ki * vr_dim1 + 1], &
00724 c__1);
00725 }
00726
00727 emax = 0.f;
00728 i__1 = *n;
00729 for (k = 1; k <= i__1; ++k) {
00730
00731 r__3 = emax, r__4 = (r__1 = vr[k + (ki - 1) * vr_dim1]
00732 , dabs(r__1)) + (r__2 = vr[k + ki * vr_dim1],
00733 dabs(r__2));
00734 emax = dmax(r__3,r__4);
00735
00736 }
00737 remax = 1.f / emax;
00738 sscal_(n, &remax, &vr[(ki - 1) * vr_dim1 + 1], &c__1);
00739 sscal_(n, &remax, &vr[ki * vr_dim1 + 1], &c__1);
00740 }
00741 }
00742
00743 --is;
00744 if (ip != 0) {
00745 --is;
00746 }
00747 L130:
00748 if (ip == 1) {
00749 ip = 0;
00750 }
00751 if (ip == -1) {
00752 ip = 1;
00753 }
00754
00755 }
00756 }
00757
00758 if (leftv) {
00759
00760
00761
00762 ip = 0;
00763 is = 1;
00764 i__1 = *n;
00765 for (ki = 1; ki <= i__1; ++ki) {
00766
00767 if (ip == -1) {
00768 goto L250;
00769 }
00770 if (ki == *n) {
00771 goto L150;
00772 }
00773 if (t[ki + 1 + ki * t_dim1] == 0.f) {
00774 goto L150;
00775 }
00776 ip = 1;
00777
00778 L150:
00779 if (somev) {
00780 if (! select[ki]) {
00781 goto L250;
00782 }
00783 }
00784
00785
00786
00787 wr = t[ki + ki * t_dim1];
00788 wi = 0.f;
00789 if (ip != 0) {
00790 wi = sqrt((r__1 = t[ki + (ki + 1) * t_dim1], dabs(r__1))) *
00791 sqrt((r__2 = t[ki + 1 + ki * t_dim1], dabs(r__2)));
00792 }
00793
00794 r__1 = ulp * (dabs(wr) + dabs(wi));
00795 smin = dmax(r__1,smlnum);
00796
00797 if (ip == 0) {
00798
00799
00800
00801 work[ki + *n] = 1.f;
00802
00803
00804
00805 i__2 = *n;
00806 for (k = ki + 1; k <= i__2; ++k) {
00807 work[k + *n] = -t[ki + k * t_dim1];
00808
00809 }
00810
00811
00812
00813
00814 vmax = 1.f;
00815 vcrit = bignum;
00816
00817 jnxt = ki + 1;
00818 i__2 = *n;
00819 for (j = ki + 1; j <= i__2; ++j) {
00820 if (j < jnxt) {
00821 goto L170;
00822 }
00823 j1 = j;
00824 j2 = j;
00825 jnxt = j + 1;
00826 if (j < *n) {
00827 if (t[j + 1 + j * t_dim1] != 0.f) {
00828 j2 = j + 1;
00829 jnxt = j + 2;
00830 }
00831 }
00832
00833 if (j1 == j2) {
00834
00835
00836
00837
00838
00839
00840 if (work[j] > vcrit) {
00841 rec = 1.f / vmax;
00842 i__3 = *n - ki + 1;
00843 sscal_(&i__3, &rec, &work[ki + *n], &c__1);
00844 vmax = 1.f;
00845 vcrit = bignum;
00846 }
00847
00848 i__3 = j - ki - 1;
00849 work[j + *n] -= sdot_(&i__3, &t[ki + 1 + j * t_dim1],
00850 &c__1, &work[ki + 1 + *n], &c__1);
00851
00852
00853
00854 slaln2_(&c_false, &c__1, &c__1, &smin, &c_b22, &t[j +
00855 j * t_dim1], ldt, &c_b22, &c_b22, &work[j + *
00856 n], n, &wr, &c_b25, x, &c__2, &scale, &xnorm,
00857 &ierr);
00858
00859
00860
00861 if (scale != 1.f) {
00862 i__3 = *n - ki + 1;
00863 sscal_(&i__3, &scale, &work[ki + *n], &c__1);
00864 }
00865 work[j + *n] = x[0];
00866
00867 r__2 = (r__1 = work[j + *n], dabs(r__1));
00868 vmax = dmax(r__2,vmax);
00869 vcrit = bignum / vmax;
00870
00871 } else {
00872
00873
00874
00875
00876
00877
00878
00879 r__1 = work[j], r__2 = work[j + 1];
00880 beta = dmax(r__1,r__2);
00881 if (beta > vcrit) {
00882 rec = 1.f / vmax;
00883 i__3 = *n - ki + 1;
00884 sscal_(&i__3, &rec, &work[ki + *n], &c__1);
00885 vmax = 1.f;
00886 vcrit = bignum;
00887 }
00888
00889 i__3 = j - ki - 1;
00890 work[j + *n] -= sdot_(&i__3, &t[ki + 1 + j * t_dim1],
00891 &c__1, &work[ki + 1 + *n], &c__1);
00892
00893 i__3 = j - ki - 1;
00894 work[j + 1 + *n] -= sdot_(&i__3, &t[ki + 1 + (j + 1) *
00895 t_dim1], &c__1, &work[ki + 1 + *n], &c__1);
00896
00897
00898
00899
00900
00901 slaln2_(&c_true, &c__2, &c__1, &smin, &c_b22, &t[j +
00902 j * t_dim1], ldt, &c_b22, &c_b22, &work[j + *
00903 n], n, &wr, &c_b25, x, &c__2, &scale, &xnorm,
00904 &ierr);
00905
00906
00907
00908 if (scale != 1.f) {
00909 i__3 = *n - ki + 1;
00910 sscal_(&i__3, &scale, &work[ki + *n], &c__1);
00911 }
00912 work[j + *n] = x[0];
00913 work[j + 1 + *n] = x[1];
00914
00915
00916 r__3 = (r__1 = work[j + *n], dabs(r__1)), r__4 = (
00917 r__2 = work[j + 1 + *n], dabs(r__2)), r__3 =
00918 max(r__3,r__4);
00919 vmax = dmax(r__3,vmax);
00920 vcrit = bignum / vmax;
00921
00922 }
00923 L170:
00924 ;
00925 }
00926
00927
00928
00929 if (! over) {
00930 i__2 = *n - ki + 1;
00931 scopy_(&i__2, &work[ki + *n], &c__1, &vl[ki + is *
00932 vl_dim1], &c__1);
00933
00934 i__2 = *n - ki + 1;
00935 ii = isamax_(&i__2, &vl[ki + is * vl_dim1], &c__1) + ki -
00936 1;
00937 remax = 1.f / (r__1 = vl[ii + is * vl_dim1], dabs(r__1));
00938 i__2 = *n - ki + 1;
00939 sscal_(&i__2, &remax, &vl[ki + is * vl_dim1], &c__1);
00940
00941 i__2 = ki - 1;
00942 for (k = 1; k <= i__2; ++k) {
00943 vl[k + is * vl_dim1] = 0.f;
00944
00945 }
00946
00947 } else {
00948
00949 if (ki < *n) {
00950 i__2 = *n - ki;
00951 sgemv_("N", n, &i__2, &c_b22, &vl[(ki + 1) * vl_dim1
00952 + 1], ldvl, &work[ki + 1 + *n], &c__1, &work[
00953 ki + *n], &vl[ki * vl_dim1 + 1], &c__1);
00954 }
00955
00956 ii = isamax_(n, &vl[ki * vl_dim1 + 1], &c__1);
00957 remax = 1.f / (r__1 = vl[ii + ki * vl_dim1], dabs(r__1));
00958 sscal_(n, &remax, &vl[ki * vl_dim1 + 1], &c__1);
00959
00960 }
00961
00962 } else {
00963
00964
00965
00966
00967
00968
00969
00970 if ((r__1 = t[ki + (ki + 1) * t_dim1], dabs(r__1)) >= (r__2 =
00971 t[ki + 1 + ki * t_dim1], dabs(r__2))) {
00972 work[ki + *n] = wi / t[ki + (ki + 1) * t_dim1];
00973 work[ki + 1 + n2] = 1.f;
00974 } else {
00975 work[ki + *n] = 1.f;
00976 work[ki + 1 + n2] = -wi / t[ki + 1 + ki * t_dim1];
00977 }
00978 work[ki + 1 + *n] = 0.f;
00979 work[ki + n2] = 0.f;
00980
00981
00982
00983 i__2 = *n;
00984 for (k = ki + 2; k <= i__2; ++k) {
00985 work[k + *n] = -work[ki + *n] * t[ki + k * t_dim1];
00986 work[k + n2] = -work[ki + 1 + n2] * t[ki + 1 + k * t_dim1]
00987 ;
00988
00989 }
00990
00991
00992
00993
00994 vmax = 1.f;
00995 vcrit = bignum;
00996
00997 jnxt = ki + 2;
00998 i__2 = *n;
00999 for (j = ki + 2; j <= i__2; ++j) {
01000 if (j < jnxt) {
01001 goto L200;
01002 }
01003 j1 = j;
01004 j2 = j;
01005 jnxt = j + 1;
01006 if (j < *n) {
01007 if (t[j + 1 + j * t_dim1] != 0.f) {
01008 j2 = j + 1;
01009 jnxt = j + 2;
01010 }
01011 }
01012
01013 if (j1 == j2) {
01014
01015
01016
01017
01018
01019
01020 if (work[j] > vcrit) {
01021 rec = 1.f / vmax;
01022 i__3 = *n - ki + 1;
01023 sscal_(&i__3, &rec, &work[ki + *n], &c__1);
01024 i__3 = *n - ki + 1;
01025 sscal_(&i__3, &rec, &work[ki + n2], &c__1);
01026 vmax = 1.f;
01027 vcrit = bignum;
01028 }
01029
01030 i__3 = j - ki - 2;
01031 work[j + *n] -= sdot_(&i__3, &t[ki + 2 + j * t_dim1],
01032 &c__1, &work[ki + 2 + *n], &c__1);
01033 i__3 = j - ki - 2;
01034 work[j + n2] -= sdot_(&i__3, &t[ki + 2 + j * t_dim1],
01035 &c__1, &work[ki + 2 + n2], &c__1);
01036
01037
01038
01039 r__1 = -wi;
01040 slaln2_(&c_false, &c__1, &c__2, &smin, &c_b22, &t[j +
01041 j * t_dim1], ldt, &c_b22, &c_b22, &work[j + *
01042 n], n, &wr, &r__1, x, &c__2, &scale, &xnorm, &
01043 ierr);
01044
01045
01046
01047 if (scale != 1.f) {
01048 i__3 = *n - ki + 1;
01049 sscal_(&i__3, &scale, &work[ki + *n], &c__1);
01050 i__3 = *n - ki + 1;
01051 sscal_(&i__3, &scale, &work[ki + n2], &c__1);
01052 }
01053 work[j + *n] = x[0];
01054 work[j + n2] = x[2];
01055
01056 r__3 = (r__1 = work[j + *n], dabs(r__1)), r__4 = (
01057 r__2 = work[j + n2], dabs(r__2)), r__3 = max(
01058 r__3,r__4);
01059 vmax = dmax(r__3,vmax);
01060 vcrit = bignum / vmax;
01061
01062 } else {
01063
01064
01065
01066
01067
01068
01069
01070 r__1 = work[j], r__2 = work[j + 1];
01071 beta = dmax(r__1,r__2);
01072 if (beta > vcrit) {
01073 rec = 1.f / vmax;
01074 i__3 = *n - ki + 1;
01075 sscal_(&i__3, &rec, &work[ki + *n], &c__1);
01076 i__3 = *n - ki + 1;
01077 sscal_(&i__3, &rec, &work[ki + n2], &c__1);
01078 vmax = 1.f;
01079 vcrit = bignum;
01080 }
01081
01082 i__3 = j - ki - 2;
01083 work[j + *n] -= sdot_(&i__3, &t[ki + 2 + j * t_dim1],
01084 &c__1, &work[ki + 2 + *n], &c__1);
01085
01086 i__3 = j - ki - 2;
01087 work[j + n2] -= sdot_(&i__3, &t[ki + 2 + j * t_dim1],
01088 &c__1, &work[ki + 2 + n2], &c__1);
01089
01090 i__3 = j - ki - 2;
01091 work[j + 1 + *n] -= sdot_(&i__3, &t[ki + 2 + (j + 1) *
01092 t_dim1], &c__1, &work[ki + 2 + *n], &c__1);
01093
01094 i__3 = j - ki - 2;
01095 work[j + 1 + n2] -= sdot_(&i__3, &t[ki + 2 + (j + 1) *
01096 t_dim1], &c__1, &work[ki + 2 + n2], &c__1);
01097
01098
01099
01100
01101
01102 r__1 = -wi;
01103 slaln2_(&c_true, &c__2, &c__2, &smin, &c_b22, &t[j +
01104 j * t_dim1], ldt, &c_b22, &c_b22, &work[j + *
01105 n], n, &wr, &r__1, x, &c__2, &scale, &xnorm, &
01106 ierr);
01107
01108
01109
01110 if (scale != 1.f) {
01111 i__3 = *n - ki + 1;
01112 sscal_(&i__3, &scale, &work[ki + *n], &c__1);
01113 i__3 = *n - ki + 1;
01114 sscal_(&i__3, &scale, &work[ki + n2], &c__1);
01115 }
01116 work[j + *n] = x[0];
01117 work[j + n2] = x[2];
01118 work[j + 1 + *n] = x[1];
01119 work[j + 1 + n2] = x[3];
01120
01121 r__1 = dabs(x[0]), r__2 = dabs(x[2]), r__1 = max(r__1,
01122 r__2), r__2 = dabs(x[1]), r__1 = max(r__1,
01123 r__2), r__2 = dabs(x[3]), r__1 = max(r__1,
01124 r__2);
01125 vmax = dmax(r__1,vmax);
01126 vcrit = bignum / vmax;
01127
01128 }
01129 L200:
01130 ;
01131 }
01132
01133
01134
01135 if (! over) {
01136 i__2 = *n - ki + 1;
01137 scopy_(&i__2, &work[ki + *n], &c__1, &vl[ki + is *
01138 vl_dim1], &c__1);
01139 i__2 = *n - ki + 1;
01140 scopy_(&i__2, &work[ki + n2], &c__1, &vl[ki + (is + 1) *
01141 vl_dim1], &c__1);
01142
01143 emax = 0.f;
01144 i__2 = *n;
01145 for (k = ki; k <= i__2; ++k) {
01146
01147 r__3 = emax, r__4 = (r__1 = vl[k + is * vl_dim1],
01148 dabs(r__1)) + (r__2 = vl[k + (is + 1) *
01149 vl_dim1], dabs(r__2));
01150 emax = dmax(r__3,r__4);
01151
01152 }
01153 remax = 1.f / emax;
01154 i__2 = *n - ki + 1;
01155 sscal_(&i__2, &remax, &vl[ki + is * vl_dim1], &c__1);
01156 i__2 = *n - ki + 1;
01157 sscal_(&i__2, &remax, &vl[ki + (is + 1) * vl_dim1], &c__1)
01158 ;
01159
01160 i__2 = ki - 1;
01161 for (k = 1; k <= i__2; ++k) {
01162 vl[k + is * vl_dim1] = 0.f;
01163 vl[k + (is + 1) * vl_dim1] = 0.f;
01164
01165 }
01166 } else {
01167 if (ki < *n - 1) {
01168 i__2 = *n - ki - 1;
01169 sgemv_("N", n, &i__2, &c_b22, &vl[(ki + 2) * vl_dim1
01170 + 1], ldvl, &work[ki + 2 + *n], &c__1, &work[
01171 ki + *n], &vl[ki * vl_dim1 + 1], &c__1);
01172 i__2 = *n - ki - 1;
01173 sgemv_("N", n, &i__2, &c_b22, &vl[(ki + 2) * vl_dim1
01174 + 1], ldvl, &work[ki + 2 + n2], &c__1, &work[
01175 ki + 1 + n2], &vl[(ki + 1) * vl_dim1 + 1], &
01176 c__1);
01177 } else {
01178 sscal_(n, &work[ki + *n], &vl[ki * vl_dim1 + 1], &
01179 c__1);
01180 sscal_(n, &work[ki + 1 + n2], &vl[(ki + 1) * vl_dim1
01181 + 1], &c__1);
01182 }
01183
01184 emax = 0.f;
01185 i__2 = *n;
01186 for (k = 1; k <= i__2; ++k) {
01187
01188 r__3 = emax, r__4 = (r__1 = vl[k + ki * vl_dim1],
01189 dabs(r__1)) + (r__2 = vl[k + (ki + 1) *
01190 vl_dim1], dabs(r__2));
01191 emax = dmax(r__3,r__4);
01192
01193 }
01194 remax = 1.f / emax;
01195 sscal_(n, &remax, &vl[ki * vl_dim1 + 1], &c__1);
01196 sscal_(n, &remax, &vl[(ki + 1) * vl_dim1 + 1], &c__1);
01197
01198 }
01199
01200 }
01201
01202 ++is;
01203 if (ip != 0) {
01204 ++is;
01205 }
01206 L250:
01207 if (ip == -1) {
01208 ip = 0;
01209 }
01210 if (ip == 1) {
01211 ip = -1;
01212 }
01213
01214
01215 }
01216
01217 }
01218
01219 return 0;
01220
01221
01222
01223 }