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