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