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