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 integer c__1 = 1;
00019 static real c_b22 = 0.f;
00020 static logical c_true = TRUE_;
00021 static logical c_false = FALSE_;
00022
00023 int slatmt_(integer *m, integer *n, char *dist, integer *
00024 iseed, char *sym, real *d__, integer *mode, real *cond, real *dmax__,
00025 integer *rank, integer *kl, integer *ku, char *pack, real *a, integer
00026 *lda, real *work, integer *info)
00027 {
00028
00029 integer a_dim1, a_offset, i__1, i__2, i__3, i__4, i__5, i__6;
00030 real r__1, r__2, r__3;
00031 logical L__1;
00032
00033
00034 double cos(doublereal), sin(doublereal);
00035
00036
00037 real c__;
00038 integer i__, j, k;
00039 real s;
00040 integer ic, jc, nc, il, ir, jr, mr, ir1, ir2, jch, llb, jkl, jku, uub,
00041 ilda, icol;
00042 real temp;
00043 integer irow, isym;
00044 real alpha, angle;
00045 integer ipack, ioffg;
00046 extern logical lsame_(char *, char *);
00047 integer iinfo;
00048 extern int sscal_(integer *, real *, real *, integer *);
00049 integer idist, mnmin, iskew;
00050 real extra, dummy;
00051 extern int scopy_(integer *, real *, integer *, real *,
00052 integer *), slatm7_(integer *, real *, integer *, integer *,
00053 integer *, real *, integer *, integer *, integer *);
00054 integer iendch, ipackg;
00055 extern int slagge_(integer *, integer *, integer *,
00056 integer *, real *, real *, integer *, integer *, real *, integer *
00057 );
00058 integer minlda;
00059 extern int xerbla_(char *, integer *);
00060 extern doublereal slarnd_(integer *, integer *);
00061 integer ioffst, irsign;
00062 logical givens, iltemp;
00063 extern int slartg_(real *, real *, real *, real *, real *
00064 ), slaset_(char *, integer *, integer *, real *, real *, real *,
00065 integer *), slagsy_(integer *, integer *, real *, real *,
00066 integer *, integer *, real *, integer *), slarot_(logical *,
00067 logical *, logical *, integer *, real *, real *, real *, integer *
00068 , real *, real *);
00069 logical ilextr, topdwn;
00070 integer isympk;
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
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 --iseed;
00340 --d__;
00341 a_dim1 = *lda;
00342 a_offset = 1 + a_dim1;
00343 a -= a_offset;
00344 --work;
00345
00346
00347 *info = 0;
00348
00349
00350
00351 if (*m == 0 || *n == 0) {
00352 return 0;
00353 }
00354
00355
00356
00357 if (lsame_(dist, "U")) {
00358 idist = 1;
00359 } else if (lsame_(dist, "S")) {
00360 idist = 2;
00361 } else if (lsame_(dist, "N")) {
00362 idist = 3;
00363 } else {
00364 idist = -1;
00365 }
00366
00367
00368
00369 if (lsame_(sym, "N")) {
00370 isym = 1;
00371 irsign = 0;
00372 } else if (lsame_(sym, "P")) {
00373 isym = 2;
00374 irsign = 0;
00375 } else if (lsame_(sym, "S")) {
00376 isym = 2;
00377 irsign = 1;
00378 } else if (lsame_(sym, "H")) {
00379 isym = 2;
00380 irsign = 1;
00381 } else {
00382 isym = -1;
00383 }
00384
00385
00386
00387 isympk = 0;
00388 if (lsame_(pack, "N")) {
00389 ipack = 0;
00390 } else if (lsame_(pack, "U")) {
00391 ipack = 1;
00392 isympk = 1;
00393 } else if (lsame_(pack, "L")) {
00394 ipack = 2;
00395 isympk = 1;
00396 } else if (lsame_(pack, "C")) {
00397 ipack = 3;
00398 isympk = 2;
00399 } else if (lsame_(pack, "R")) {
00400 ipack = 4;
00401 isympk = 3;
00402 } else if (lsame_(pack, "B")) {
00403 ipack = 5;
00404 isympk = 3;
00405 } else if (lsame_(pack, "Q")) {
00406 ipack = 6;
00407 isympk = 2;
00408 } else if (lsame_(pack, "Z")) {
00409 ipack = 7;
00410 } else {
00411 ipack = -1;
00412 }
00413
00414
00415
00416 mnmin = min(*m,*n);
00417
00418 i__1 = *kl, i__2 = *m - 1;
00419 llb = min(i__1,i__2);
00420
00421 i__1 = *ku, i__2 = *n - 1;
00422 uub = min(i__1,i__2);
00423
00424 i__1 = *m, i__2 = *n + llb;
00425 mr = min(i__1,i__2);
00426
00427 i__1 = *n, i__2 = *m + uub;
00428 nc = min(i__1,i__2);
00429
00430 if (ipack == 5 || ipack == 6) {
00431 minlda = uub + 1;
00432 } else if (ipack == 7) {
00433 minlda = llb + uub + 1;
00434 } else {
00435 minlda = *m;
00436 }
00437
00438
00439
00440
00441 givens = FALSE_;
00442 if (isym == 1) {
00443
00444 i__1 = 1, i__2 = mr + nc;
00445 if ((real) (llb + uub) < (real) max(i__1,i__2) * .3f) {
00446 givens = TRUE_;
00447 }
00448 } else {
00449 if (llb << 1 < *m) {
00450 givens = TRUE_;
00451 }
00452 }
00453 if (*lda < *m && *lda >= minlda) {
00454 givens = TRUE_;
00455 }
00456
00457
00458
00459 if (*m < 0) {
00460 *info = -1;
00461 } else if (*m != *n && isym != 1) {
00462 *info = -1;
00463 } else if (*n < 0) {
00464 *info = -2;
00465 } else if (idist == -1) {
00466 *info = -3;
00467 } else if (isym == -1) {
00468 *info = -5;
00469 } else if (abs(*mode) > 6) {
00470 *info = -7;
00471 } else if (*mode != 0 && abs(*mode) != 6 && *cond < 1.f) {
00472 *info = -8;
00473 } else if (*kl < 0) {
00474 *info = -10;
00475 } else if (*ku < 0 || isym != 1 && *kl != *ku) {
00476 *info = -11;
00477 } else if (ipack == -1 || isympk == 1 && isym == 1 || isympk == 2 && isym
00478 == 1 && *kl > 0 || isympk == 3 && isym == 1 && *ku > 0 || isympk
00479 != 0 && *m != *n) {
00480 *info = -12;
00481 } else if (*lda < max(1,minlda)) {
00482 *info = -14;
00483 }
00484
00485 if (*info != 0) {
00486 i__1 = -(*info);
00487 xerbla_("SLATMT", &i__1);
00488 return 0;
00489 }
00490
00491
00492
00493 for (i__ = 1; i__ <= 4; ++i__) {
00494 iseed[i__] = (i__1 = iseed[i__], abs(i__1)) % 4096;
00495
00496 }
00497
00498 if (iseed[4] % 2 != 1) {
00499 ++iseed[4];
00500 }
00501
00502
00503
00504
00505
00506 slatm7_(mode, cond, &irsign, &idist, &iseed[1], &d__[1], &mnmin, rank, &
00507 iinfo);
00508 if (iinfo != 0) {
00509 *info = 1;
00510 return 0;
00511 }
00512
00513
00514
00515
00516 if (dabs(d__[1]) <= (r__1 = d__[*rank], dabs(r__1))) {
00517 topdwn = TRUE_;
00518 } else {
00519 topdwn = FALSE_;
00520 }
00521
00522 if (*mode != 0 && abs(*mode) != 6) {
00523
00524
00525
00526 temp = dabs(d__[1]);
00527 i__1 = *rank;
00528 for (i__ = 2; i__ <= i__1; ++i__) {
00529
00530 r__2 = temp, r__3 = (r__1 = d__[i__], dabs(r__1));
00531 temp = dmax(r__2,r__3);
00532
00533 }
00534
00535 if (temp > 0.f) {
00536 alpha = *dmax__ / temp;
00537 } else {
00538 *info = 2;
00539 return 0;
00540 }
00541
00542 sscal_(rank, &alpha, &d__[1], &c__1);
00543
00544 }
00545
00546
00547
00548
00549
00550
00551
00552
00553
00554
00555 if (ipack > 4) {
00556 ilda = *lda - 1;
00557 iskew = 1;
00558 if (ipack > 5) {
00559 ioffst = uub + 1;
00560 } else {
00561 ioffst = 1;
00562 }
00563 } else {
00564 ilda = *lda;
00565 iskew = 0;
00566 ioffst = 0;
00567 }
00568
00569
00570
00571
00572
00573 ipackg = 0;
00574 slaset_("Full", lda, n, &c_b22, &c_b22, &a[a_offset], lda);
00575
00576
00577
00578
00579 if (llb == 0 && uub == 0) {
00580 i__1 = ilda + 1;
00581 scopy_(&mnmin, &d__[1], &c__1, &a[1 - iskew + ioffst + a_dim1], &i__1)
00582 ;
00583 if (ipack <= 2 || ipack >= 5) {
00584 ipackg = ipack;
00585 }
00586
00587 } else if (givens) {
00588
00589
00590
00591
00592 if (isym == 1) {
00593
00594
00595
00596 if (ipack > 4) {
00597 ipackg = ipack;
00598 } else {
00599 ipackg = 0;
00600 }
00601
00602 i__1 = ilda + 1;
00603 scopy_(&mnmin, &d__[1], &c__1, &a[1 - iskew + ioffst + a_dim1], &
00604 i__1);
00605
00606 if (topdwn) {
00607 jkl = 0;
00608 i__1 = uub;
00609 for (jku = 1; jku <= i__1; ++jku) {
00610
00611
00612
00613
00614
00615
00616
00617 i__3 = *m + jku;
00618 i__2 = min(i__3,*n) + jkl - 1;
00619 for (jr = 1; jr <= i__2; ++jr) {
00620 extra = 0.f;
00621 angle = slarnd_(&c__1, &iseed[1]) *
00622 6.2831853071795864769252867663f;
00623 c__ = cos(angle);
00624 s = sin(angle);
00625
00626 i__3 = 1, i__4 = jr - jkl;
00627 icol = max(i__3,i__4);
00628 if (jr < *m) {
00629
00630 i__3 = *n, i__4 = jr + jku;
00631 il = min(i__3,i__4) + 1 - icol;
00632 L__1 = jr > jkl;
00633 slarot_(&c_true, &L__1, &c_false, &il, &c__, &s, &
00634 a[jr - iskew * icol + ioffst + icol *
00635 a_dim1], &ilda, &extra, &dummy);
00636 }
00637
00638
00639
00640 ir = jr;
00641 ic = icol;
00642 i__3 = -jkl - jku;
00643 for (jch = jr - jkl; i__3 < 0 ? jch >= 1 : jch <= 1;
00644 jch += i__3) {
00645 if (ir < *m) {
00646 slartg_(&a[ir + 1 - iskew * (ic + 1) + ioffst
00647 + (ic + 1) * a_dim1], &extra, &c__, &
00648 s, &dummy);
00649 }
00650
00651 i__4 = 1, i__5 = jch - jku;
00652 irow = max(i__4,i__5);
00653 il = ir + 2 - irow;
00654 temp = 0.f;
00655 iltemp = jch > jku;
00656 r__1 = -s;
00657 slarot_(&c_false, &iltemp, &c_true, &il, &c__, &
00658 r__1, &a[irow - iskew * ic + ioffst + ic *
00659 a_dim1], &ilda, &temp, &extra);
00660 if (iltemp) {
00661 slartg_(&a[irow + 1 - iskew * (ic + 1) +
00662 ioffst + (ic + 1) * a_dim1], &temp, &
00663 c__, &s, &dummy);
00664
00665 i__4 = 1, i__5 = jch - jku - jkl;
00666 icol = max(i__4,i__5);
00667 il = ic + 2 - icol;
00668 extra = 0.f;
00669 L__1 = jch > jku + jkl;
00670 r__1 = -s;
00671 slarot_(&c_true, &L__1, &c_true, &il, &c__, &
00672 r__1, &a[irow - iskew * icol + ioffst
00673 + icol * a_dim1], &ilda, &extra, &
00674 temp);
00675 ic = icol;
00676 ir = irow;
00677 }
00678
00679 }
00680
00681 }
00682
00683 }
00684
00685 jku = uub;
00686 i__1 = llb;
00687 for (jkl = 1; jkl <= i__1; ++jkl) {
00688
00689
00690
00691
00692 i__3 = *n + jkl;
00693 i__2 = min(i__3,*m) + jku - 1;
00694 for (jc = 1; jc <= i__2; ++jc) {
00695 extra = 0.f;
00696 angle = slarnd_(&c__1, &iseed[1]) *
00697 6.2831853071795864769252867663f;
00698 c__ = cos(angle);
00699 s = sin(angle);
00700
00701 i__3 = 1, i__4 = jc - jku;
00702 irow = max(i__3,i__4);
00703 if (jc < *n) {
00704
00705 i__3 = *m, i__4 = jc + jkl;
00706 il = min(i__3,i__4) + 1 - irow;
00707 L__1 = jc > jku;
00708 slarot_(&c_false, &L__1, &c_false, &il, &c__, &s,
00709 &a[irow - iskew * jc + ioffst + jc *
00710 a_dim1], &ilda, &extra, &dummy);
00711 }
00712
00713
00714
00715 ic = jc;
00716 ir = irow;
00717 i__3 = -jkl - jku;
00718 for (jch = jc - jku; i__3 < 0 ? jch >= 1 : jch <= 1;
00719 jch += i__3) {
00720 if (ic < *n) {
00721 slartg_(&a[ir + 1 - iskew * (ic + 1) + ioffst
00722 + (ic + 1) * a_dim1], &extra, &c__, &
00723 s, &dummy);
00724 }
00725
00726 i__4 = 1, i__5 = jch - jkl;
00727 icol = max(i__4,i__5);
00728 il = ic + 2 - icol;
00729 temp = 0.f;
00730 iltemp = jch > jkl;
00731 r__1 = -s;
00732 slarot_(&c_true, &iltemp, &c_true, &il, &c__, &
00733 r__1, &a[ir - iskew * icol + ioffst +
00734 icol * a_dim1], &ilda, &temp, &extra);
00735 if (iltemp) {
00736 slartg_(&a[ir + 1 - iskew * (icol + 1) +
00737 ioffst + (icol + 1) * a_dim1], &temp,
00738 &c__, &s, &dummy);
00739
00740 i__4 = 1, i__5 = jch - jkl - jku;
00741 irow = max(i__4,i__5);
00742 il = ir + 2 - irow;
00743 extra = 0.f;
00744 L__1 = jch > jkl + jku;
00745 r__1 = -s;
00746 slarot_(&c_false, &L__1, &c_true, &il, &c__, &
00747 r__1, &a[irow - iskew * icol + ioffst
00748 + icol * a_dim1], &ilda, &extra, &
00749 temp);
00750 ic = icol;
00751 ir = irow;
00752 }
00753
00754 }
00755
00756 }
00757
00758 }
00759
00760 } else {
00761
00762
00763
00764 jkl = 0;
00765 i__1 = uub;
00766 for (jku = 1; jku <= i__1; ++jku) {
00767
00768
00769
00770
00771
00772
00773
00774 i__2 = *m, i__3 = *n + jkl;
00775 iendch = min(i__2,i__3) - 1;
00776
00777 i__2 = *m + jku;
00778 i__3 = 1 - jkl;
00779 for (jc = min(i__2,*n) - 1; jc >= i__3; --jc) {
00780 extra = 0.f;
00781 angle = slarnd_(&c__1, &iseed[1]) *
00782 6.2831853071795864769252867663f;
00783 c__ = cos(angle);
00784 s = sin(angle);
00785
00786 i__2 = 1, i__4 = jc - jku + 1;
00787 irow = max(i__2,i__4);
00788 if (jc > 0) {
00789
00790 i__2 = *m, i__4 = jc + jkl + 1;
00791 il = min(i__2,i__4) + 1 - irow;
00792 L__1 = jc + jkl < *m;
00793 slarot_(&c_false, &c_false, &L__1, &il, &c__, &s,
00794 &a[irow - iskew * jc + ioffst + jc *
00795 a_dim1], &ilda, &dummy, &extra);
00796 }
00797
00798
00799
00800 ic = jc;
00801 i__2 = iendch;
00802 i__4 = jkl + jku;
00803 for (jch = jc + jkl; i__4 < 0 ? jch >= i__2 : jch <=
00804 i__2; jch += i__4) {
00805 ilextr = ic > 0;
00806 if (ilextr) {
00807 slartg_(&a[jch - iskew * ic + ioffst + ic *
00808 a_dim1], &extra, &c__, &s, &dummy);
00809 }
00810 ic = max(1,ic);
00811
00812 i__5 = *n - 1, i__6 = jch + jku;
00813 icol = min(i__5,i__6);
00814 iltemp = jch + jku < *n;
00815 temp = 0.f;
00816 i__5 = icol + 2 - ic;
00817 slarot_(&c_true, &ilextr, &iltemp, &i__5, &c__, &
00818 s, &a[jch - iskew * ic + ioffst + ic *
00819 a_dim1], &ilda, &extra, &temp);
00820 if (iltemp) {
00821 slartg_(&a[jch - iskew * icol + ioffst + icol
00822 * a_dim1], &temp, &c__, &s, &dummy);
00823
00824 i__5 = iendch, i__6 = jch + jkl + jku;
00825 il = min(i__5,i__6) + 2 - jch;
00826 extra = 0.f;
00827 L__1 = jch + jkl + jku <= iendch;
00828 slarot_(&c_false, &c_true, &L__1, &il, &c__, &
00829 s, &a[jch - iskew * icol + ioffst +
00830 icol * a_dim1], &ilda, &temp, &extra);
00831 ic = icol;
00832 }
00833
00834 }
00835
00836 }
00837
00838 }
00839
00840 jku = uub;
00841 i__1 = llb;
00842 for (jkl = 1; jkl <= i__1; ++jkl) {
00843
00844
00845
00846
00847
00848
00849
00850 i__3 = *n, i__4 = *m + jku;
00851 iendch = min(i__3,i__4) - 1;
00852
00853 i__3 = *n + jkl;
00854 i__4 = 1 - jku;
00855 for (jr = min(i__3,*m) - 1; jr >= i__4; --jr) {
00856 extra = 0.f;
00857 angle = slarnd_(&c__1, &iseed[1]) *
00858 6.2831853071795864769252867663f;
00859 c__ = cos(angle);
00860 s = sin(angle);
00861
00862 i__3 = 1, i__2 = jr - jkl + 1;
00863 icol = max(i__3,i__2);
00864 if (jr > 0) {
00865
00866 i__3 = *n, i__2 = jr + jku + 1;
00867 il = min(i__3,i__2) + 1 - icol;
00868 L__1 = jr + jku < *n;
00869 slarot_(&c_true, &c_false, &L__1, &il, &c__, &s, &
00870 a[jr - iskew * icol + ioffst + icol *
00871 a_dim1], &ilda, &dummy, &extra);
00872 }
00873
00874
00875
00876 ir = jr;
00877 i__3 = iendch;
00878 i__2 = jkl + jku;
00879 for (jch = jr + jku; i__2 < 0 ? jch >= i__3 : jch <=
00880 i__3; jch += i__2) {
00881 ilextr = ir > 0;
00882 if (ilextr) {
00883 slartg_(&a[ir - iskew * jch + ioffst + jch *
00884 a_dim1], &extra, &c__, &s, &dummy);
00885 }
00886 ir = max(1,ir);
00887
00888 i__5 = *m - 1, i__6 = jch + jkl;
00889 irow = min(i__5,i__6);
00890 iltemp = jch + jkl < *m;
00891 temp = 0.f;
00892 i__5 = irow + 2 - ir;
00893 slarot_(&c_false, &ilextr, &iltemp, &i__5, &c__, &
00894 s, &a[ir - iskew * jch + ioffst + jch *
00895 a_dim1], &ilda, &extra, &temp);
00896 if (iltemp) {
00897 slartg_(&a[irow - iskew * jch + ioffst + jch *
00898 a_dim1], &temp, &c__, &s, &dummy);
00899
00900 i__5 = iendch, i__6 = jch + jkl + jku;
00901 il = min(i__5,i__6) + 2 - jch;
00902 extra = 0.f;
00903 L__1 = jch + jkl + jku <= iendch;
00904 slarot_(&c_true, &c_true, &L__1, &il, &c__, &
00905 s, &a[irow - iskew * jch + ioffst +
00906 jch * a_dim1], &ilda, &temp, &extra);
00907 ir = irow;
00908 }
00909
00910 }
00911
00912 }
00913
00914 }
00915 }
00916
00917 } else {
00918
00919
00920
00921 ipackg = ipack;
00922 ioffg = ioffst;
00923
00924 if (topdwn) {
00925
00926
00927
00928 if (ipack >= 5) {
00929 ipackg = 6;
00930 ioffg = uub + 1;
00931 } else {
00932 ipackg = 1;
00933 }
00934 i__1 = ilda + 1;
00935 scopy_(&mnmin, &d__[1], &c__1, &a[1 - iskew + ioffg + a_dim1],
00936 &i__1);
00937
00938 i__1 = uub;
00939 for (k = 1; k <= i__1; ++k) {
00940 i__4 = *n - 1;
00941 for (jc = 1; jc <= i__4; ++jc) {
00942
00943 i__2 = 1, i__3 = jc - k;
00944 irow = max(i__2,i__3);
00945
00946 i__2 = jc + 1, i__3 = k + 2;
00947 il = min(i__2,i__3);
00948 extra = 0.f;
00949 temp = a[jc - iskew * (jc + 1) + ioffg + (jc + 1) *
00950 a_dim1];
00951 angle = slarnd_(&c__1, &iseed[1]) *
00952 6.2831853071795864769252867663f;
00953 c__ = cos(angle);
00954 s = sin(angle);
00955 L__1 = jc > k;
00956 slarot_(&c_false, &L__1, &c_true, &il, &c__, &s, &a[
00957 irow - iskew * jc + ioffg + jc * a_dim1], &
00958 ilda, &extra, &temp);
00959
00960 i__3 = k, i__5 = *n - jc;
00961 i__2 = min(i__3,i__5) + 1;
00962 slarot_(&c_true, &c_true, &c_false, &i__2, &c__, &s, &
00963 a[(1 - iskew) * jc + ioffg + jc * a_dim1], &
00964 ilda, &temp, &dummy);
00965
00966
00967
00968 icol = jc;
00969 i__2 = -k;
00970 for (jch = jc - k; i__2 < 0 ? jch >= 1 : jch <= 1;
00971 jch += i__2) {
00972 slartg_(&a[jch + 1 - iskew * (icol + 1) + ioffg +
00973 (icol + 1) * a_dim1], &extra, &c__, &s, &
00974 dummy);
00975 temp = a[jch - iskew * (jch + 1) + ioffg + (jch +
00976 1) * a_dim1];
00977 i__3 = k + 2;
00978 r__1 = -s;
00979 slarot_(&c_true, &c_true, &c_true, &i__3, &c__, &
00980 r__1, &a[(1 - iskew) * jch + ioffg + jch *
00981 a_dim1], &ilda, &temp, &extra);
00982
00983 i__3 = 1, i__5 = jch - k;
00984 irow = max(i__3,i__5);
00985
00986 i__3 = jch + 1, i__5 = k + 2;
00987 il = min(i__3,i__5);
00988 extra = 0.f;
00989 L__1 = jch > k;
00990 r__1 = -s;
00991 slarot_(&c_false, &L__1, &c_true, &il, &c__, &
00992 r__1, &a[irow - iskew * jch + ioffg + jch
00993 * a_dim1], &ilda, &extra, &temp);
00994 icol = jch;
00995
00996 }
00997
00998 }
00999
01000 }
01001
01002
01003
01004
01005 if (ipack != ipackg && ipack != 3) {
01006 i__1 = *n;
01007 for (jc = 1; jc <= i__1; ++jc) {
01008 irow = ioffst - iskew * jc;
01009
01010 i__2 = *n, i__3 = jc + uub;
01011 i__4 = min(i__2,i__3);
01012 for (jr = jc; jr <= i__4; ++jr) {
01013 a[jr + irow + jc * a_dim1] = a[jc - iskew * jr +
01014 ioffg + jr * a_dim1];
01015
01016 }
01017
01018 }
01019 if (ipack == 5) {
01020 i__1 = *n;
01021 for (jc = *n - uub + 1; jc <= i__1; ++jc) {
01022 i__4 = uub + 1;
01023 for (jr = *n + 2 - jc; jr <= i__4; ++jr) {
01024 a[jr + jc * a_dim1] = 0.f;
01025
01026 }
01027
01028 }
01029 }
01030 if (ipackg == 6) {
01031 ipackg = ipack;
01032 } else {
01033 ipackg = 0;
01034 }
01035 }
01036 } else {
01037
01038
01039
01040 if (ipack >= 5) {
01041 ipackg = 5;
01042 if (ipack == 6) {
01043 ioffg = 1;
01044 }
01045 } else {
01046 ipackg = 2;
01047 }
01048 i__1 = ilda + 1;
01049 scopy_(&mnmin, &d__[1], &c__1, &a[1 - iskew + ioffg + a_dim1],
01050 &i__1);
01051
01052 i__1 = uub;
01053 for (k = 1; k <= i__1; ++k) {
01054 for (jc = *n - 1; jc >= 1; --jc) {
01055
01056 i__4 = *n + 1 - jc, i__2 = k + 2;
01057 il = min(i__4,i__2);
01058 extra = 0.f;
01059 temp = a[(1 - iskew) * jc + 1 + ioffg + jc * a_dim1];
01060 angle = slarnd_(&c__1, &iseed[1]) *
01061 6.2831853071795864769252867663f;
01062 c__ = cos(angle);
01063 s = -sin(angle);
01064 L__1 = *n - jc > k;
01065 slarot_(&c_false, &c_true, &L__1, &il, &c__, &s, &a[(
01066 1 - iskew) * jc + ioffg + jc * a_dim1], &ilda,
01067 &temp, &extra);
01068
01069 i__4 = 1, i__2 = jc - k + 1;
01070 icol = max(i__4,i__2);
01071 i__4 = jc + 2 - icol;
01072 slarot_(&c_true, &c_false, &c_true, &i__4, &c__, &s, &
01073 a[jc - iskew * icol + ioffg + icol * a_dim1],
01074 &ilda, &dummy, &temp);
01075
01076
01077
01078 icol = jc;
01079 i__4 = *n - 1;
01080 i__2 = k;
01081 for (jch = jc + k; i__2 < 0 ? jch >= i__4 : jch <=
01082 i__4; jch += i__2) {
01083 slartg_(&a[jch - iskew * icol + ioffg + icol *
01084 a_dim1], &extra, &c__, &s, &dummy);
01085 temp = a[(1 - iskew) * jch + 1 + ioffg + jch *
01086 a_dim1];
01087 i__3 = k + 2;
01088 slarot_(&c_true, &c_true, &c_true, &i__3, &c__, &
01089 s, &a[jch - iskew * icol + ioffg + icol *
01090 a_dim1], &ilda, &extra, &temp);
01091
01092 i__3 = *n + 1 - jch, i__5 = k + 2;
01093 il = min(i__3,i__5);
01094 extra = 0.f;
01095 L__1 = *n - jch > k;
01096 slarot_(&c_false, &c_true, &L__1, &il, &c__, &s, &
01097 a[(1 - iskew) * jch + ioffg + jch *
01098 a_dim1], &ilda, &temp, &extra);
01099 icol = jch;
01100
01101 }
01102
01103 }
01104
01105 }
01106
01107
01108
01109
01110 if (ipack != ipackg && ipack != 4) {
01111 for (jc = *n; jc >= 1; --jc) {
01112 irow = ioffst - iskew * jc;
01113
01114 i__2 = 1, i__4 = jc - uub;
01115 i__1 = max(i__2,i__4);
01116 for (jr = jc; jr >= i__1; --jr) {
01117 a[jr + irow + jc * a_dim1] = a[jc - iskew * jr +
01118 ioffg + jr * a_dim1];
01119
01120 }
01121
01122 }
01123 if (ipack == 6) {
01124 i__1 = uub;
01125 for (jc = 1; jc <= i__1; ++jc) {
01126 i__2 = uub + 1 - jc;
01127 for (jr = 1; jr <= i__2; ++jr) {
01128 a[jr + jc * a_dim1] = 0.f;
01129
01130 }
01131
01132 }
01133 }
01134 if (ipackg == 5) {
01135 ipackg = ipack;
01136 } else {
01137 ipackg = 0;
01138 }
01139 }
01140 }
01141 }
01142
01143 } else {
01144
01145
01146
01147
01148
01149
01150
01151
01152 if (isym == 1) {
01153
01154
01155
01156 slagge_(&mr, &nc, &llb, &uub, &d__[1], &a[a_offset], lda, &iseed[
01157 1], &work[1], &iinfo);
01158 } else {
01159
01160
01161
01162 slagsy_(m, &llb, &d__[1], &a[a_offset], lda, &iseed[1], &work[1],
01163 &iinfo);
01164
01165 }
01166 if (iinfo != 0) {
01167 *info = 3;
01168 return 0;
01169 }
01170 }
01171
01172
01173
01174 if (ipack != ipackg) {
01175 if (ipack == 1) {
01176
01177
01178
01179 i__1 = *m;
01180 for (j = 1; j <= i__1; ++j) {
01181 i__2 = *m;
01182 for (i__ = j + 1; i__ <= i__2; ++i__) {
01183 a[i__ + j * a_dim1] = 0.f;
01184
01185 }
01186
01187 }
01188
01189 } else if (ipack == 2) {
01190
01191
01192
01193 i__1 = *m;
01194 for (j = 2; j <= i__1; ++j) {
01195 i__2 = j - 1;
01196 for (i__ = 1; i__ <= i__2; ++i__) {
01197 a[i__ + j * a_dim1] = 0.f;
01198
01199 }
01200
01201 }
01202
01203 } else if (ipack == 3) {
01204
01205
01206
01207 icol = 1;
01208 irow = 0;
01209 i__1 = *m;
01210 for (j = 1; j <= i__1; ++j) {
01211 i__2 = j;
01212 for (i__ = 1; i__ <= i__2; ++i__) {
01213 ++irow;
01214 if (irow > *lda) {
01215 irow = 1;
01216 ++icol;
01217 }
01218 a[irow + icol * a_dim1] = a[i__ + j * a_dim1];
01219
01220 }
01221
01222 }
01223
01224 } else if (ipack == 4) {
01225
01226
01227
01228 icol = 1;
01229 irow = 0;
01230 i__1 = *m;
01231 for (j = 1; j <= i__1; ++j) {
01232 i__2 = *m;
01233 for (i__ = j; i__ <= i__2; ++i__) {
01234 ++irow;
01235 if (irow > *lda) {
01236 irow = 1;
01237 ++icol;
01238 }
01239 a[irow + icol * a_dim1] = a[i__ + j * a_dim1];
01240
01241 }
01242
01243 }
01244
01245 } else if (ipack >= 5) {
01246
01247
01248
01249
01250
01251 if (ipack == 5) {
01252 uub = 0;
01253 }
01254 if (ipack == 6) {
01255 llb = 0;
01256 }
01257
01258 i__1 = uub;
01259 for (j = 1; j <= i__1; ++j) {
01260
01261 i__2 = j + llb;
01262 for (i__ = min(i__2,*m); i__ >= 1; --i__) {
01263 a[i__ - j + uub + 1 + j * a_dim1] = a[i__ + j * a_dim1];
01264
01265 }
01266
01267 }
01268
01269 i__1 = *n;
01270 for (j = uub + 2; j <= i__1; ++j) {
01271
01272 i__4 = j + llb;
01273 i__2 = min(i__4,*m);
01274 for (i__ = j - uub; i__ <= i__2; ++i__) {
01275 a[i__ - j + uub + 1 + j * a_dim1] = a[i__ + j * a_dim1];
01276
01277 }
01278
01279 }
01280 }
01281
01282
01283
01284
01285
01286
01287 if (ipack == 3 || ipack == 4) {
01288 i__1 = *m;
01289 for (jc = icol; jc <= i__1; ++jc) {
01290 i__2 = *lda;
01291 for (jr = irow + 1; jr <= i__2; ++jr) {
01292 a[jr + jc * a_dim1] = 0.f;
01293
01294 }
01295 irow = 0;
01296
01297 }
01298
01299 } else if (ipack >= 5) {
01300
01301
01302
01303
01304
01305
01306
01307 ir1 = uub + llb + 2;
01308 ir2 = uub + *m + 2;
01309 i__1 = *n;
01310 for (jc = 1; jc <= i__1; ++jc) {
01311 i__2 = uub + 1 - jc;
01312 for (jr = 1; jr <= i__2; ++jr) {
01313 a[jr + jc * a_dim1] = 0.f;
01314
01315 }
01316
01317
01318 i__3 = ir1, i__5 = ir2 - jc;
01319 i__2 = 1, i__4 = min(i__3,i__5);
01320 i__6 = *lda;
01321 for (jr = max(i__2,i__4); jr <= i__6; ++jr) {
01322 a[jr + jc * a_dim1] = 0.f;
01323
01324 }
01325
01326 }
01327 }
01328 }
01329
01330 return 0;
01331
01332
01333
01334 }