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