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