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