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__2 = 2;
00019 static integer c__1 = 1;
00020 static doublereal c_b36 = 2.;
00021 static doublereal c_b47 = 1.;
00022 static integer c_n1 = -1;
00023
00024 int dlattb_(integer *imat, char *uplo, char *trans, char *
00025 diag, integer *iseed, integer *n, integer *kd, doublereal *ab,
00026 integer *ldab, doublereal *b, doublereal *work, integer *info)
00027 {
00028
00029 integer ab_dim1, ab_offset, i__1, i__2, i__3, i__4, i__5;
00030 doublereal d__1, d__2;
00031
00032
00033 int s_copy(char *, char *, ftnlen, ftnlen);
00034 double sqrt(doublereal), d_sign(doublereal *, doublereal *), pow_dd(
00035 doublereal *, doublereal *);
00036
00037
00038 integer i__, j, kl, ku, iy;
00039 doublereal ulp, sfac;
00040 integer ioff, mode, lenj;
00041 char path[3], dist[1];
00042 doublereal unfl, rexp;
00043 char type__[1];
00044 doublereal texp, star1, plus1, plus2, bscal;
00045 extern int dscal_(integer *, doublereal *, doublereal *,
00046 integer *);
00047 extern logical lsame_(char *, char *);
00048 doublereal tscal, anorm, bnorm, tleft;
00049 extern int dcopy_(integer *, doublereal *, integer *,
00050 doublereal *, integer *), dswap_(integer *, doublereal *, integer
00051 *, doublereal *, integer *);
00052 logical upper;
00053 doublereal tnorm;
00054 extern int dlatb4_(char *, integer *, integer *, integer
00055 *, char *, integer *, integer *, doublereal *, integer *,
00056 doublereal *, char *), dlabad_(doublereal
00057 *, doublereal *);
00058 extern doublereal dlamch_(char *);
00059 extern integer idamax_(integer *, doublereal *, integer *);
00060 extern doublereal dlarnd_(integer *, integer *);
00061 char packit[1];
00062 doublereal bignum, cndnum;
00063 extern int dlatms_(integer *, integer *, char *, integer
00064 *, char *, doublereal *, integer *, doublereal *, doublereal *,
00065 integer *, integer *, char *, doublereal *, integer *, doublereal
00066 *, integer *), dlarnv_(integer *, integer
00067 *, integer *, doublereal *);
00068 integer jcount;
00069 doublereal smlnum;
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 --iseed;
00156 ab_dim1 = *ldab;
00157 ab_offset = 1 + ab_dim1;
00158 ab -= ab_offset;
00159 --b;
00160 --work;
00161
00162
00163 s_copy(path, "Double precision", (ftnlen)1, (ftnlen)16);
00164 s_copy(path + 1, "TB", (ftnlen)2, (ftnlen)2);
00165 unfl = dlamch_("Safe minimum");
00166 ulp = dlamch_("Epsilon") * dlamch_("Base");
00167 smlnum = unfl;
00168 bignum = (1. - ulp) / smlnum;
00169 dlabad_(&smlnum, &bignum);
00170 if (*imat >= 6 && *imat <= 9 || *imat == 17) {
00171 *(unsigned char *)diag = 'U';
00172 } else {
00173 *(unsigned char *)diag = 'N';
00174 }
00175 *info = 0;
00176
00177
00178
00179 if (*n <= 0) {
00180 return 0;
00181 }
00182
00183
00184
00185 upper = lsame_(uplo, "U");
00186 if (upper) {
00187 dlatb4_(path, imat, n, n, type__, &kl, &ku, &anorm, &mode, &cndnum,
00188 dist);
00189 ku = *kd;
00190
00191 i__1 = 0, i__2 = *kd - *n + 1;
00192 ioff = max(i__1,i__2) + 1;
00193 kl = 0;
00194 *(unsigned char *)packit = 'Q';
00195 } else {
00196 i__1 = -(*imat);
00197 dlatb4_(path, &i__1, n, n, type__, &kl, &ku, &anorm, &mode, &cndnum,
00198 dist);
00199 kl = *kd;
00200 ioff = 1;
00201 ku = 0;
00202 *(unsigned char *)packit = 'B';
00203 }
00204
00205
00206
00207 if (*imat <= 5) {
00208 dlatms_(n, n, dist, &iseed[1], type__, &b[1], &mode, &cndnum, &anorm,
00209 &kl, &ku, packit, &ab[ioff + ab_dim1], ldab, &work[1], info);
00210
00211
00212
00213
00214
00215
00216 } else if (*imat == 6) {
00217 if (upper) {
00218 i__1 = *n;
00219 for (j = 1; j <= i__1; ++j) {
00220
00221 i__2 = 1, i__3 = *kd + 2 - j;
00222 i__4 = *kd;
00223 for (i__ = max(i__2,i__3); i__ <= i__4; ++i__) {
00224 ab[i__ + j * ab_dim1] = 0.;
00225
00226 }
00227 ab[*kd + 1 + j * ab_dim1] = (doublereal) j;
00228
00229 }
00230 } else {
00231 i__1 = *n;
00232 for (j = 1; j <= i__1; ++j) {
00233 ab[j * ab_dim1 + 1] = (doublereal) j;
00234
00235 i__2 = *kd + 1, i__3 = *n - j + 1;
00236 i__4 = min(i__2,i__3);
00237 for (i__ = 2; i__ <= i__4; ++i__) {
00238 ab[i__ + j * ab_dim1] = 0.;
00239
00240 }
00241
00242 }
00243 }
00244
00245
00246
00247
00248
00249
00250 } else if (*imat <= 9) {
00251 tnorm = sqrt(cndnum);
00252
00253
00254
00255 if (upper) {
00256 i__1 = *n;
00257 for (j = 1; j <= i__1; ++j) {
00258
00259 i__4 = 1, i__2 = *kd + 2 - j;
00260 i__3 = *kd;
00261 for (i__ = max(i__4,i__2); i__ <= i__3; ++i__) {
00262 ab[i__ + j * ab_dim1] = 0.;
00263
00264 }
00265 ab[*kd + 1 + j * ab_dim1] = (doublereal) j;
00266
00267 }
00268 } else {
00269 i__1 = *n;
00270 for (j = 1; j <= i__1; ++j) {
00271
00272 i__4 = *kd + 1, i__2 = *n - j + 1;
00273 i__3 = min(i__4,i__2);
00274 for (i__ = 2; i__ <= i__3; ++i__) {
00275 ab[i__ + j * ab_dim1] = 0.;
00276
00277 }
00278 ab[j * ab_dim1 + 1] = (doublereal) j;
00279
00280 }
00281 }
00282
00283
00284
00285
00286 if (*kd == 1) {
00287 if (upper) {
00288 d__1 = dlarnd_(&c__2, &iseed[1]);
00289 ab[(ab_dim1 << 1) + 1] = d_sign(&tnorm, &d__1);
00290 lenj = (*n - 3) / 2;
00291 dlarnv_(&c__2, &iseed[1], &lenj, &work[1]);
00292 i__1 = lenj;
00293 for (j = 1; j <= i__1; ++j) {
00294 ab[(j + 1 << 1) * ab_dim1 + 1] = tnorm * work[j];
00295
00296 }
00297 } else {
00298 d__1 = dlarnd_(&c__2, &iseed[1]);
00299 ab[ab_dim1 + 2] = d_sign(&tnorm, &d__1);
00300 lenj = (*n - 3) / 2;
00301 dlarnv_(&c__2, &iseed[1], &lenj, &work[1]);
00302 i__1 = lenj;
00303 for (j = 1; j <= i__1; ++j) {
00304 ab[((j << 1) + 1) * ab_dim1 + 2] = tnorm * work[j];
00305
00306 }
00307 }
00308 } else if (*kd > 1) {
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326 d__1 = dlarnd_(&c__2, &iseed[1]);
00327 star1 = d_sign(&tnorm, &d__1);
00328 sfac = sqrt(tnorm);
00329 d__1 = dlarnd_(&c__2, &iseed[1]);
00330 plus1 = d_sign(&sfac, &d__1);
00331 i__1 = *n;
00332 for (j = 1; j <= i__1; j += 2) {
00333 plus2 = star1 / plus1;
00334 work[j] = plus1;
00335 work[*n + j] = star1;
00336 if (j + 1 <= *n) {
00337 work[j + 1] = plus2;
00338 work[*n + j + 1] = 0.;
00339 plus1 = star1 / plus2;
00340
00341
00342
00343
00344 rexp = dlarnd_(&c__2, &iseed[1]);
00345 if (rexp < 0.) {
00346 d__1 = 1. - rexp;
00347 star1 = -pow_dd(&sfac, &d__1);
00348 } else {
00349 d__1 = rexp + 1.;
00350 star1 = pow_dd(&sfac, &d__1);
00351 }
00352 }
00353
00354 }
00355
00356
00357
00358 if (upper) {
00359 i__1 = *n - 1;
00360 dcopy_(&i__1, &work[1], &c__1, &ab[*kd + (ab_dim1 << 1)],
00361 ldab);
00362 i__1 = *n - 2;
00363 dcopy_(&i__1, &work[*n + 1], &c__1, &ab[*kd - 1 + ab_dim1 * 3]
00364 , ldab);
00365 } else {
00366 i__1 = *n - 1;
00367 dcopy_(&i__1, &work[1], &c__1, &ab[ab_dim1 + 2], ldab);
00368 i__1 = *n - 2;
00369 dcopy_(&i__1, &work[*n + 1], &c__1, &ab[ab_dim1 + 3], ldab);
00370 }
00371 }
00372
00373
00374
00375
00376
00377 } else if (*imat == 10) {
00378
00379
00380
00381
00382
00383 if (upper) {
00384 i__1 = *n;
00385 for (j = 1; j <= i__1; ++j) {
00386
00387 i__3 = j, i__4 = *kd + 1;
00388 lenj = min(i__3,i__4);
00389 dlarnv_(&c__2, &iseed[1], &lenj, &ab[*kd + 2 - lenj + j *
00390 ab_dim1]);
00391 ab[*kd + 1 + j * ab_dim1] = d_sign(&c_b36, &ab[*kd + 1 + j *
00392 ab_dim1]);
00393
00394 }
00395 } else {
00396 i__1 = *n;
00397 for (j = 1; j <= i__1; ++j) {
00398
00399 i__3 = *n - j + 1, i__4 = *kd + 1;
00400 lenj = min(i__3,i__4);
00401 if (lenj > 0) {
00402 dlarnv_(&c__2, &iseed[1], &lenj, &ab[j * ab_dim1 + 1]);
00403 }
00404 ab[j * ab_dim1 + 1] = d_sign(&c_b36, &ab[j * ab_dim1 + 1]);
00405
00406 }
00407 }
00408
00409
00410
00411 dlarnv_(&c__2, &iseed[1], n, &b[1]);
00412 iy = idamax_(n, &b[1], &c__1);
00413 bnorm = (d__1 = b[iy], abs(d__1));
00414 bscal = bignum / max(1.,bnorm);
00415 dscal_(n, &bscal, &b[1], &c__1);
00416
00417 } else if (*imat == 11) {
00418
00419
00420
00421
00422
00423 dlarnv_(&c__2, &iseed[1], n, &b[1]);
00424 tscal = 1. / (doublereal) (*kd + 1);
00425 if (upper) {
00426 i__1 = *n;
00427 for (j = 1; j <= i__1; ++j) {
00428
00429 i__3 = j, i__4 = *kd + 1;
00430 lenj = min(i__3,i__4);
00431 dlarnv_(&c__2, &iseed[1], &lenj, &ab[*kd + 2 - lenj + j *
00432 ab_dim1]);
00433 i__3 = lenj - 1;
00434 dscal_(&i__3, &tscal, &ab[*kd + 2 - lenj + j * ab_dim1], &
00435 c__1);
00436 ab[*kd + 1 + j * ab_dim1] = d_sign(&c_b47, &ab[*kd + 1 + j *
00437 ab_dim1]);
00438
00439 }
00440 ab[*kd + 1 + *n * ab_dim1] = smlnum * ab[*kd + 1 + *n * ab_dim1];
00441 } else {
00442 i__1 = *n;
00443 for (j = 1; j <= i__1; ++j) {
00444
00445 i__3 = *n - j + 1, i__4 = *kd + 1;
00446 lenj = min(i__3,i__4);
00447 dlarnv_(&c__2, &iseed[1], &lenj, &ab[j * ab_dim1 + 1]);
00448 if (lenj > 1) {
00449 i__3 = lenj - 1;
00450 dscal_(&i__3, &tscal, &ab[j * ab_dim1 + 2], &c__1);
00451 }
00452 ab[j * ab_dim1 + 1] = d_sign(&c_b47, &ab[j * ab_dim1 + 1]);
00453
00454 }
00455 ab[ab_dim1 + 1] = smlnum * ab[ab_dim1 + 1];
00456 }
00457
00458 } else if (*imat == 12) {
00459
00460
00461
00462
00463
00464 dlarnv_(&c__2, &iseed[1], n, &b[1]);
00465 if (upper) {
00466 i__1 = *n;
00467 for (j = 1; j <= i__1; ++j) {
00468
00469 i__3 = j, i__4 = *kd + 1;
00470 lenj = min(i__3,i__4);
00471 dlarnv_(&c__2, &iseed[1], &lenj, &ab[*kd + 2 - lenj + j *
00472 ab_dim1]);
00473 ab[*kd + 1 + j * ab_dim1] = d_sign(&c_b47, &ab[*kd + 1 + j *
00474 ab_dim1]);
00475
00476 }
00477 ab[*kd + 1 + *n * ab_dim1] = smlnum * ab[*kd + 1 + *n * ab_dim1];
00478 } else {
00479 i__1 = *n;
00480 for (j = 1; j <= i__1; ++j) {
00481
00482 i__3 = *n - j + 1, i__4 = *kd + 1;
00483 lenj = min(i__3,i__4);
00484 dlarnv_(&c__2, &iseed[1], &lenj, &ab[j * ab_dim1 + 1]);
00485 ab[j * ab_dim1 + 1] = d_sign(&c_b47, &ab[j * ab_dim1 + 1]);
00486
00487 }
00488 ab[ab_dim1 + 1] = smlnum * ab[ab_dim1 + 1];
00489 }
00490
00491 } else if (*imat == 13) {
00492
00493
00494
00495
00496
00497 if (upper) {
00498 jcount = 1;
00499 for (j = *n; j >= 1; --j) {
00500
00501 i__1 = 1, i__3 = *kd + 1 - (j - 1);
00502 i__4 = *kd;
00503 for (i__ = max(i__1,i__3); i__ <= i__4; ++i__) {
00504 ab[i__ + j * ab_dim1] = 0.;
00505
00506 }
00507 if (jcount <= 2) {
00508 ab[*kd + 1 + j * ab_dim1] = smlnum;
00509 } else {
00510 ab[*kd + 1 + j * ab_dim1] = 1.;
00511 }
00512 ++jcount;
00513 if (jcount > 4) {
00514 jcount = 1;
00515 }
00516
00517 }
00518 } else {
00519 jcount = 1;
00520 i__4 = *n;
00521 for (j = 1; j <= i__4; ++j) {
00522
00523 i__3 = *n - j + 1, i__2 = *kd + 1;
00524 i__1 = min(i__3,i__2);
00525 for (i__ = 2; i__ <= i__1; ++i__) {
00526 ab[i__ + j * ab_dim1] = 0.;
00527
00528 }
00529 if (jcount <= 2) {
00530 ab[j * ab_dim1 + 1] = smlnum;
00531 } else {
00532 ab[j * ab_dim1 + 1] = 1.;
00533 }
00534 ++jcount;
00535 if (jcount > 4) {
00536 jcount = 1;
00537 }
00538
00539 }
00540 }
00541
00542
00543
00544 if (upper) {
00545 b[1] = 0.;
00546 for (i__ = *n; i__ >= 2; i__ += -2) {
00547 b[i__] = 0.;
00548 b[i__ - 1] = smlnum;
00549
00550 }
00551 } else {
00552 b[*n] = 0.;
00553 i__4 = *n - 1;
00554 for (i__ = 1; i__ <= i__4; i__ += 2) {
00555 b[i__] = 0.;
00556 b[i__ + 1] = smlnum;
00557
00558 }
00559 }
00560
00561 } else if (*imat == 14) {
00562
00563
00564
00565
00566
00567 texp = 1. / (doublereal) (*kd + 1);
00568 tscal = pow_dd(&smlnum, &texp);
00569 dlarnv_(&c__2, &iseed[1], n, &b[1]);
00570 if (upper) {
00571 i__4 = *n;
00572 for (j = 1; j <= i__4; ++j) {
00573
00574 i__1 = 1, i__3 = *kd + 2 - j;
00575 i__2 = *kd;
00576 for (i__ = max(i__1,i__3); i__ <= i__2; ++i__) {
00577 ab[i__ + j * ab_dim1] = 0.;
00578
00579 }
00580 if (j > 1 && *kd > 0) {
00581 ab[*kd + j * ab_dim1] = -1.;
00582 }
00583 ab[*kd + 1 + j * ab_dim1] = tscal;
00584
00585 }
00586 b[*n] = 1.;
00587 } else {
00588 i__4 = *n;
00589 for (j = 1; j <= i__4; ++j) {
00590
00591 i__1 = *n - j + 1, i__3 = *kd + 1;
00592 i__2 = min(i__1,i__3);
00593 for (i__ = 3; i__ <= i__2; ++i__) {
00594 ab[i__ + j * ab_dim1] = 0.;
00595
00596 }
00597 if (j < *n && *kd > 0) {
00598 ab[j * ab_dim1 + 2] = -1.;
00599 }
00600 ab[j * ab_dim1 + 1] = tscal;
00601
00602 }
00603 b[1] = 1.;
00604 }
00605
00606 } else if (*imat == 15) {
00607
00608
00609
00610 iy = *n / 2 + 1;
00611 if (upper) {
00612 i__4 = *n;
00613 for (j = 1; j <= i__4; ++j) {
00614
00615 i__2 = j, i__1 = *kd + 1;
00616 lenj = min(i__2,i__1);
00617 dlarnv_(&c__2, &iseed[1], &lenj, &ab[*kd + 2 - lenj + j *
00618 ab_dim1]);
00619 if (j != iy) {
00620 ab[*kd + 1 + j * ab_dim1] = d_sign(&c_b36, &ab[*kd + 1 +
00621 j * ab_dim1]);
00622 } else {
00623 ab[*kd + 1 + j * ab_dim1] = 0.;
00624 }
00625
00626 }
00627 } else {
00628 i__4 = *n;
00629 for (j = 1; j <= i__4; ++j) {
00630
00631 i__2 = *n - j + 1, i__1 = *kd + 1;
00632 lenj = min(i__2,i__1);
00633 dlarnv_(&c__2, &iseed[1], &lenj, &ab[j * ab_dim1 + 1]);
00634 if (j != iy) {
00635 ab[j * ab_dim1 + 1] = d_sign(&c_b36, &ab[j * ab_dim1 + 1])
00636 ;
00637 } else {
00638 ab[j * ab_dim1 + 1] = 0.;
00639 }
00640
00641 }
00642 }
00643 dlarnv_(&c__2, &iseed[1], n, &b[1]);
00644 dscal_(n, &c_b36, &b[1], &c__1);
00645
00646 } else if (*imat == 16) {
00647
00648
00649
00650
00651
00652
00653 tscal = unfl / ulp;
00654 tscal = (1. - ulp) / tscal;
00655 i__4 = *n;
00656 for (j = 1; j <= i__4; ++j) {
00657 i__2 = *kd + 1;
00658 for (i__ = 1; i__ <= i__2; ++i__) {
00659 ab[i__ + j * ab_dim1] = 0.;
00660
00661 }
00662
00663 }
00664 texp = 1.;
00665 if (*kd > 0) {
00666 if (upper) {
00667 i__4 = -(*kd);
00668 for (j = *n; i__4 < 0 ? j >= 1 : j <= 1; j += i__4) {
00669
00670 i__1 = 1, i__3 = j - *kd + 1;
00671 i__2 = max(i__1,i__3);
00672 for (i__ = j; i__ >= i__2; i__ += -2) {
00673 ab[j - i__ + 1 + i__ * ab_dim1] = -tscal / (
00674 doublereal) (*kd + 2);
00675 ab[*kd + 1 + i__ * ab_dim1] = 1.;
00676 b[i__] = texp * (1. - ulp);
00677
00678 i__1 = 1, i__3 = j - *kd + 1;
00679 if (i__ > max(i__1,i__3)) {
00680 ab[j - i__ + 2 + (i__ - 1) * ab_dim1] = -(tscal /
00681 (doublereal) (*kd + 2)) / (doublereal) (*
00682 kd + 3);
00683 ab[*kd + 1 + (i__ - 1) * ab_dim1] = 1.;
00684 b[i__ - 1] = texp * (doublereal) ((*kd + 1) * (*
00685 kd + 1) + *kd);
00686 }
00687 texp *= 2.;
00688
00689 }
00690
00691 i__2 = 1, i__1 = j - *kd + 1;
00692 b[max(i__2,i__1)] = (doublereal) (*kd + 2) / (doublereal)
00693 (*kd + 3) * tscal;
00694
00695 }
00696 } else {
00697 i__4 = *n;
00698 i__2 = *kd;
00699 for (j = 1; i__2 < 0 ? j >= i__4 : j <= i__4; j += i__2) {
00700 texp = 1.;
00701
00702 i__1 = *kd + 1, i__3 = *n - j + 1;
00703 lenj = min(i__1,i__3);
00704
00705 i__3 = *n, i__5 = j + *kd - 1;
00706 i__1 = min(i__3,i__5);
00707 for (i__ = j; i__ <= i__1; i__ += 2) {
00708 ab[lenj - (i__ - j) + j * ab_dim1] = -tscal / (
00709 doublereal) (*kd + 2);
00710 ab[j * ab_dim1 + 1] = 1.;
00711 b[j] = texp * (1. - ulp);
00712
00713 i__3 = *n, i__5 = j + *kd - 1;
00714 if (i__ < min(i__3,i__5)) {
00715 ab[lenj - (i__ - j + 1) + (i__ + 1) * ab_dim1] =
00716 -(tscal / (doublereal) (*kd + 2)) / (
00717 doublereal) (*kd + 3);
00718 ab[(i__ + 1) * ab_dim1 + 1] = 1.;
00719 b[i__ + 1] = texp * (doublereal) ((*kd + 1) * (*
00720 kd + 1) + *kd);
00721 }
00722 texp *= 2.;
00723
00724 }
00725
00726 i__1 = *n, i__3 = j + *kd - 1;
00727 b[min(i__1,i__3)] = (doublereal) (*kd + 2) / (doublereal)
00728 (*kd + 3) * tscal;
00729
00730 }
00731 }
00732 } else {
00733 i__2 = *n;
00734 for (j = 1; j <= i__2; ++j) {
00735 ab[j * ab_dim1 + 1] = 1.;
00736 b[j] = (doublereal) j;
00737
00738 }
00739 }
00740
00741 } else if (*imat == 17) {
00742
00743
00744
00745
00746
00747 if (upper) {
00748 i__2 = *n;
00749 for (j = 1; j <= i__2; ++j) {
00750
00751 i__4 = j - 1;
00752 lenj = min(i__4,*kd);
00753 dlarnv_(&c__2, &iseed[1], &lenj, &ab[*kd + 1 - lenj + j *
00754 ab_dim1]);
00755 ab[*kd + 1 + j * ab_dim1] = (doublereal) j;
00756
00757 }
00758 } else {
00759 i__2 = *n;
00760 for (j = 1; j <= i__2; ++j) {
00761
00762 i__4 = *n - j;
00763 lenj = min(i__4,*kd);
00764 if (lenj > 0) {
00765 dlarnv_(&c__2, &iseed[1], &lenj, &ab[j * ab_dim1 + 2]);
00766 }
00767 ab[j * ab_dim1 + 1] = (doublereal) j;
00768
00769 }
00770 }
00771
00772
00773
00774 dlarnv_(&c__2, &iseed[1], n, &b[1]);
00775 iy = idamax_(n, &b[1], &c__1);
00776 bnorm = (d__1 = b[iy], abs(d__1));
00777 bscal = bignum / max(1.,bnorm);
00778 dscal_(n, &bscal, &b[1], &c__1);
00779
00780 } else if (*imat == 18) {
00781
00782
00783
00784
00785
00786
00787 d__1 = 1., d__2 = (doublereal) (*kd);
00788 tleft = bignum / max(d__1,d__2);
00789 tscal = bignum * ((doublereal) (*kd) / (doublereal) (*kd + 1));
00790 if (upper) {
00791 i__2 = *n;
00792 for (j = 1; j <= i__2; ++j) {
00793
00794 i__4 = j, i__1 = *kd + 1;
00795 lenj = min(i__4,i__1);
00796 dlarnv_(&c__2, &iseed[1], &lenj, &ab[*kd + 2 - lenj + j *
00797 ab_dim1]);
00798 i__4 = *kd + 1;
00799 for (i__ = *kd + 2 - lenj; i__ <= i__4; ++i__) {
00800 ab[i__ + j * ab_dim1] = d_sign(&tleft, &ab[i__ + j *
00801 ab_dim1]) + tscal * ab[i__ + j * ab_dim1];
00802
00803 }
00804
00805 }
00806 } else {
00807 i__2 = *n;
00808 for (j = 1; j <= i__2; ++j) {
00809
00810 i__4 = *n - j + 1, i__1 = *kd + 1;
00811 lenj = min(i__4,i__1);
00812 dlarnv_(&c__2, &iseed[1], &lenj, &ab[j * ab_dim1 + 1]);
00813 i__4 = lenj;
00814 for (i__ = 1; i__ <= i__4; ++i__) {
00815 ab[i__ + j * ab_dim1] = d_sign(&tleft, &ab[i__ + j *
00816 ab_dim1]) + tscal * ab[i__ + j * ab_dim1];
00817
00818 }
00819
00820 }
00821 }
00822 dlarnv_(&c__2, &iseed[1], n, &b[1]);
00823 dscal_(n, &c_b36, &b[1], &c__1);
00824 }
00825
00826
00827
00828 if (! lsame_(trans, "N")) {
00829 if (upper) {
00830 i__2 = *n / 2;
00831 for (j = 1; j <= i__2; ++j) {
00832
00833 i__4 = *n - (j << 1) + 1, i__1 = *kd + 1;
00834 lenj = min(i__4,i__1);
00835 i__4 = *ldab - 1;
00836 dswap_(&lenj, &ab[*kd + 1 + j * ab_dim1], &i__4, &ab[*kd + 2
00837 - lenj + (*n - j + 1) * ab_dim1], &c_n1);
00838
00839 }
00840 } else {
00841 i__2 = *n / 2;
00842 for (j = 1; j <= i__2; ++j) {
00843
00844 i__4 = *n - (j << 1) + 1, i__1 = *kd + 1;
00845 lenj = min(i__4,i__1);
00846 i__4 = -(*ldab) + 1;
00847 dswap_(&lenj, &ab[j * ab_dim1 + 1], &c__1, &ab[lenj + (*n - j
00848 + 2 - lenj) * ab_dim1], &i__4);
00849
00850 }
00851 }
00852 }
00853
00854 return 0;
00855
00856
00857
00858 }