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