00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "f2c.h"
00014 #include "blaswrap.h"
00015
00016
00017
00018 struct {
00019 integer infot, nunit;
00020 logical ok, lerr;
00021 } infoc_;
00022
00023 #define infoc_1 infoc_
00024
00025 struct {
00026 char srnamt[32];
00027 } srnamc_;
00028
00029 #define srnamc_1 srnamc_
00030
00031
00032
00033 static integer c__2 = 2;
00034 static integer c__0 = 0;
00035 static integer c_n1 = -1;
00036 static integer c__1 = 1;
00037 static real c_b48 = 1.f;
00038 static real c_b49 = 0.f;
00039 static integer c__7 = 7;
00040
00041 int cchkpt_(logical *dotype, integer *nn, integer *nval,
00042 integer *nns, integer *nsval, real *thresh, logical *tsterr, complex *
00043 a, real *d__, complex *e, complex *b, complex *x, complex *xact,
00044 complex *work, real *rwork, integer *nout)
00045 {
00046
00047
00048 static integer iseedy[4] = { 0,0,0,1 };
00049 static char uplos[1*2] = "U" "L";
00050
00051
00052 static char fmt_9999[] = "(\002 N =\002,i5,\002, type \002,i2,\002, te"
00053 "st \002,i2,\002, ratio = \002,g12.5)";
00054 static char fmt_9998[] = "(\002 UPLO = '\002,a1,\002', N =\002,i5,\002, "
00055 "NRHS =\002,i3,\002, type \002,i2,\002, test \002,i2,\002, ratio "
00056 "= \002,g12.5)";
00057
00058
00059 integer i__1, i__2, i__3, i__4, i__5;
00060 real r__1, r__2;
00061
00062
00063 int s_copy(char *, char *, ftnlen, ftnlen);
00064 double c_abs(complex *);
00065 integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
00066
00067
00068 integer i__, j, k, n;
00069 complex z__[3];
00070 integer ia, in, kl, ku, ix, lda;
00071 real cond;
00072 integer mode;
00073 real dmax__;
00074 integer imat, info;
00075 char path[3], dist[1];
00076 integer irhs, nrhs;
00077 char uplo[1], type__[1];
00078 integer nrun;
00079 extern int alahd_(integer *, char *), cget04_(
00080 integer *, integer *, complex *, integer *, complex *, integer *,
00081 real *, real *);
00082 integer nfail, iseed[4];
00083 real rcond;
00084 extern int sscal_(integer *, real *, real *, integer *);
00085 integer nimat;
00086 extern doublereal sget06_(real *, real *);
00087 extern int cptt01_(integer *, real *, complex *, real *,
00088 complex *, complex *, real *);
00089 real anorm;
00090 extern int ccopy_(integer *, complex *, integer *,
00091 complex *, integer *), cptt02_(char *, integer *, integer *, real
00092 *, complex *, complex *, integer *, complex *, integer *, real *), cptt05_(integer *, integer *, real *, complex *, complex
00093 *, integer *, complex *, integer *, complex *, integer *, real *,
00094 real *, real *);
00095 integer iuplo, izero, nerrs;
00096 extern int scopy_(integer *, real *, integer *, real *,
00097 integer *);
00098 logical zerot;
00099 extern int clatb4_(char *, integer *, integer *, integer
00100 *, char *, integer *, integer *, real *, integer *, real *, char *
00101 ), alaerh_(char *, char *, integer *,
00102 integer *, char *, integer *, integer *, integer *, integer *,
00103 integer *, integer *, integer *, integer *, integer *);
00104 real rcondc;
00105 extern doublereal clanht_(char *, integer *, real *, complex *);
00106 extern int csscal_(integer *, real *, complex *, integer
00107 *), clacpy_(char *, integer *, integer *, complex *, integer *,
00108 complex *, integer *), claptm_(char *, integer *, integer
00109 *, real *, real *, complex *, complex *, integer *, real *,
00110 complex *, integer *);
00111 extern integer isamax_(integer *, real *, integer *);
00112 extern int alasum_(char *, integer *, integer *, integer
00113 *, integer *), clarnv_(integer *, integer *, integer *,
00114 complex *), cerrgt_(char *, integer *), clatms_(integer *,
00115 integer *, char *, integer *, char *, real *, integer *, real *,
00116 real *, integer *, integer *, char *, complex *, integer *,
00117 complex *, integer *);
00118 real ainvnm;
00119 extern int cptcon_(integer *, real *, complex *, real *,
00120 real *, real *, integer *);
00121 extern doublereal scasum_(integer *, complex *, integer *);
00122 extern int cptrfs_(char *, integer *, integer *, real *,
00123 complex *, real *, complex *, complex *, integer *, complex *,
00124 integer *, real *, real *, complex *, real *, integer *),
00125 cpttrf_(integer *, real *, complex *, integer *), slarnv_(integer
00126 *, integer *, integer *, real *);
00127 real result[7];
00128 extern int cpttrs_(char *, integer *, integer *, real *,
00129 complex *, complex *, integer *, integer *);
00130
00131
00132 static cilist io___30 = { 0, 0, 0, fmt_9999, 0 };
00133 static cilist io___38 = { 0, 0, 0, fmt_9998, 0 };
00134 static cilist io___40 = { 0, 0, 0, fmt_9999, 0 };
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 --rwork;
00223 --work;
00224 --xact;
00225 --x;
00226 --b;
00227 --e;
00228 --d__;
00229 --a;
00230 --nsval;
00231 --nval;
00232 --dotype;
00233
00234
00235
00236
00237
00238 s_copy(path, "Complex precision", (ftnlen)1, (ftnlen)17);
00239 s_copy(path + 1, "PT", (ftnlen)2, (ftnlen)2);
00240 nrun = 0;
00241 nfail = 0;
00242 nerrs = 0;
00243 for (i__ = 1; i__ <= 4; ++i__) {
00244 iseed[i__ - 1] = iseedy[i__ - 1];
00245
00246 }
00247
00248
00249
00250 if (*tsterr) {
00251 cerrgt_(path, nout);
00252 }
00253 infoc_1.infot = 0;
00254
00255 i__1 = *nn;
00256 for (in = 1; in <= i__1; ++in) {
00257
00258
00259
00260 n = nval[in];
00261 lda = max(1,n);
00262 nimat = 12;
00263 if (n <= 0) {
00264 nimat = 1;
00265 }
00266
00267 i__2 = nimat;
00268 for (imat = 1; imat <= i__2; ++imat) {
00269
00270
00271
00272 if (n > 0 && ! dotype[imat]) {
00273 goto L110;
00274 }
00275
00276
00277
00278 clatb4_(path, &imat, &n, &n, type__, &kl, &ku, &anorm, &mode, &
00279 cond, dist);
00280
00281 zerot = imat >= 8 && imat <= 10;
00282 if (imat <= 6) {
00283
00284
00285
00286
00287 s_copy(srnamc_1.srnamt, "CLATMS", (ftnlen)32, (ftnlen)6);
00288 clatms_(&n, &n, dist, iseed, type__, &rwork[1], &mode, &cond,
00289 &anorm, &kl, &ku, "B", &a[1], &c__2, &work[1], &info);
00290
00291
00292
00293 if (info != 0) {
00294 alaerh_(path, "CLATMS", &info, &c__0, " ", &n, &n, &kl, &
00295 ku, &c_n1, &imat, &nfail, &nerrs, nout);
00296 goto L110;
00297 }
00298 izero = 0;
00299
00300
00301
00302 ia = 1;
00303 i__3 = n - 1;
00304 for (i__ = 1; i__ <= i__3; ++i__) {
00305 i__4 = ia;
00306 d__[i__] = a[i__4].r;
00307 i__4 = i__;
00308 i__5 = ia + 1;
00309 e[i__4].r = a[i__5].r, e[i__4].i = a[i__5].i;
00310 ia += 2;
00311
00312 }
00313 if (n > 0) {
00314 i__3 = ia;
00315 d__[n] = a[i__3].r;
00316 }
00317 } else {
00318
00319
00320
00321
00322 if (! zerot || ! dotype[7]) {
00323
00324
00325
00326 slarnv_(&c__2, iseed, &n, &d__[1]);
00327 i__3 = n - 1;
00328 clarnv_(&c__2, iseed, &i__3, &e[1]);
00329
00330
00331
00332 if (n == 1) {
00333 d__[1] = dabs(d__[1]);
00334 } else {
00335 d__[1] = dabs(d__[1]) + c_abs(&e[1]);
00336 d__[n] = (r__1 = d__[n], dabs(r__1)) + c_abs(&e[n - 1]
00337 );
00338 i__3 = n - 1;
00339 for (i__ = 2; i__ <= i__3; ++i__) {
00340 d__[i__] = (r__1 = d__[i__], dabs(r__1)) + c_abs(&
00341 e[i__]) + c_abs(&e[i__ - 1]);
00342
00343 }
00344 }
00345
00346
00347
00348 ix = isamax_(&n, &d__[1], &c__1);
00349 dmax__ = d__[ix];
00350 r__1 = anorm / dmax__;
00351 sscal_(&n, &r__1, &d__[1], &c__1);
00352 i__3 = n - 1;
00353 r__1 = anorm / dmax__;
00354 csscal_(&i__3, &r__1, &e[1], &c__1);
00355
00356 } else if (izero > 0) {
00357
00358
00359
00360
00361 if (izero == 1) {
00362 d__[1] = z__[1].r;
00363 if (n > 1) {
00364 e[1].r = z__[2].r, e[1].i = z__[2].i;
00365 }
00366 } else if (izero == n) {
00367 i__3 = n - 1;
00368 e[i__3].r = z__[0].r, e[i__3].i = z__[0].i;
00369 i__3 = n;
00370 d__[i__3] = z__[1].r;
00371 } else {
00372 i__3 = izero - 1;
00373 e[i__3].r = z__[0].r, e[i__3].i = z__[0].i;
00374 i__3 = izero;
00375 d__[i__3] = z__[1].r;
00376 i__3 = izero;
00377 e[i__3].r = z__[2].r, e[i__3].i = z__[2].i;
00378 }
00379 }
00380
00381
00382
00383
00384 izero = 0;
00385 if (imat == 8) {
00386 izero = 1;
00387 z__[1].r = d__[1], z__[1].i = 0.f;
00388 d__[1] = 0.f;
00389 if (n > 1) {
00390 z__[2].r = e[1].r, z__[2].i = e[1].i;
00391 e[1].r = 0.f, e[1].i = 0.f;
00392 }
00393 } else if (imat == 9) {
00394 izero = n;
00395 if (n > 1) {
00396 i__3 = n - 1;
00397 z__[0].r = e[i__3].r, z__[0].i = e[i__3].i;
00398 i__3 = n - 1;
00399 e[i__3].r = 0.f, e[i__3].i = 0.f;
00400 }
00401 i__3 = n;
00402 z__[1].r = d__[i__3], z__[1].i = 0.f;
00403 d__[n] = 0.f;
00404 } else if (imat == 10) {
00405 izero = (n + 1) / 2;
00406 if (izero > 1) {
00407 i__3 = izero - 1;
00408 z__[0].r = e[i__3].r, z__[0].i = e[i__3].i;
00409 i__3 = izero;
00410 z__[2].r = e[i__3].r, z__[2].i = e[i__3].i;
00411 i__3 = izero - 1;
00412 e[i__3].r = 0.f, e[i__3].i = 0.f;
00413 i__3 = izero;
00414 e[i__3].r = 0.f, e[i__3].i = 0.f;
00415 }
00416 i__3 = izero;
00417 z__[1].r = d__[i__3], z__[1].i = 0.f;
00418 d__[izero] = 0.f;
00419 }
00420 }
00421
00422 scopy_(&n, &d__[1], &c__1, &d__[n + 1], &c__1);
00423 if (n > 1) {
00424 i__3 = n - 1;
00425 ccopy_(&i__3, &e[1], &c__1, &e[n + 1], &c__1);
00426 }
00427
00428
00429
00430
00431
00432 cpttrf_(&n, &d__[n + 1], &e[n + 1], &info);
00433
00434
00435
00436 if (info != izero) {
00437 alaerh_(path, "CPTTRF", &info, &izero, " ", &n, &n, &c_n1, &
00438 c_n1, &c_n1, &imat, &nfail, &nerrs, nout);
00439 goto L110;
00440 }
00441
00442 if (info > 0) {
00443 rcondc = 0.f;
00444 goto L100;
00445 }
00446
00447 cptt01_(&n, &d__[1], &e[1], &d__[n + 1], &e[n + 1], &work[1],
00448 result);
00449
00450
00451
00452 if (result[0] >= *thresh) {
00453 if (nfail == 0 && nerrs == 0) {
00454 alahd_(nout, path);
00455 }
00456 io___30.ciunit = *nout;
00457 s_wsfe(&io___30);
00458 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00459 do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(integer));
00460 do_fio(&c__1, (char *)&c__1, (ftnlen)sizeof(integer));
00461 do_fio(&c__1, (char *)&result[0], (ftnlen)sizeof(real));
00462 e_wsfe();
00463 ++nfail;
00464 }
00465 ++nrun;
00466
00467
00468
00469
00470
00471 anorm = clanht_("1", &n, &d__[1], &e[1]);
00472
00473
00474
00475
00476 ainvnm = 0.f;
00477 i__3 = n;
00478 for (i__ = 1; i__ <= i__3; ++i__) {
00479 i__4 = n;
00480 for (j = 1; j <= i__4; ++j) {
00481 i__5 = j;
00482 x[i__5].r = 0.f, x[i__5].i = 0.f;
00483
00484 }
00485 i__4 = i__;
00486 x[i__4].r = 1.f, x[i__4].i = 0.f;
00487 cpttrs_("Lower", &n, &c__1, &d__[n + 1], &e[n + 1], &x[1], &
00488 lda, &info);
00489
00490 r__1 = ainvnm, r__2 = scasum_(&n, &x[1], &c__1);
00491 ainvnm = dmax(r__1,r__2);
00492
00493 }
00494
00495 r__1 = 1.f, r__2 = anorm * ainvnm;
00496 rcondc = 1.f / dmax(r__1,r__2);
00497
00498 i__3 = *nns;
00499 for (irhs = 1; irhs <= i__3; ++irhs) {
00500 nrhs = nsval[irhs];
00501
00502
00503
00504 ix = 1;
00505 i__4 = nrhs;
00506 for (j = 1; j <= i__4; ++j) {
00507 clarnv_(&c__2, iseed, &n, &xact[ix]);
00508 ix += lda;
00509
00510 }
00511
00512 for (iuplo = 1; iuplo <= 2; ++iuplo) {
00513
00514
00515
00516 *(unsigned char *)uplo = *(unsigned char *)&uplos[iuplo -
00517 1];
00518
00519
00520
00521 claptm_(uplo, &n, &nrhs, &c_b48, &d__[1], &e[1], &xact[1],
00522 &lda, &c_b49, &b[1], &lda);
00523
00524
00525
00526
00527 clacpy_("Full", &n, &nrhs, &b[1], &lda, &x[1], &lda);
00528 cpttrs_(uplo, &n, &nrhs, &d__[n + 1], &e[n + 1], &x[1], &
00529 lda, &info);
00530
00531
00532
00533 if (info != 0) {
00534 alaerh_(path, "CPTTRS", &info, &c__0, uplo, &n, &n, &
00535 c_n1, &c_n1, &nrhs, &imat, &nfail, &nerrs,
00536 nout);
00537 }
00538
00539 clacpy_("Full", &n, &nrhs, &b[1], &lda, &work[1], &lda);
00540 cptt02_(uplo, &n, &nrhs, &d__[1], &e[1], &x[1], &lda, &
00541 work[1], &lda, &result[1]);
00542
00543
00544
00545
00546 cget04_(&n, &nrhs, &x[1], &lda, &xact[1], &lda, &rcondc, &
00547 result[2]);
00548
00549
00550
00551
00552 s_copy(srnamc_1.srnamt, "CPTRFS", (ftnlen)32, (ftnlen)6);
00553 cptrfs_(uplo, &n, &nrhs, &d__[1], &e[1], &d__[n + 1], &e[
00554 n + 1], &b[1], &lda, &x[1], &lda, &rwork[1], &
00555 rwork[nrhs + 1], &work[1], &rwork[(nrhs << 1) + 1]
00556 , &info);
00557
00558
00559
00560 if (info != 0) {
00561 alaerh_(path, "CPTRFS", &info, &c__0, uplo, &n, &n, &
00562 c_n1, &c_n1, &nrhs, &imat, &nfail, &nerrs,
00563 nout);
00564 }
00565
00566 cget04_(&n, &nrhs, &x[1], &lda, &xact[1], &lda, &rcondc, &
00567 result[3]);
00568 cptt05_(&n, &nrhs, &d__[1], &e[1], &b[1], &lda, &x[1], &
00569 lda, &xact[1], &lda, &rwork[1], &rwork[nrhs + 1],
00570 &result[4]);
00571
00572
00573
00574
00575 for (k = 2; k <= 6; ++k) {
00576 if (result[k - 1] >= *thresh) {
00577 if (nfail == 0 && nerrs == 0) {
00578 alahd_(nout, path);
00579 }
00580 io___38.ciunit = *nout;
00581 s_wsfe(&io___38);
00582 do_fio(&c__1, uplo, (ftnlen)1);
00583 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer))
00584 ;
00585 do_fio(&c__1, (char *)&nrhs, (ftnlen)sizeof(
00586 integer));
00587 do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(
00588 integer));
00589 do_fio(&c__1, (char *)&k, (ftnlen)sizeof(integer))
00590 ;
00591 do_fio(&c__1, (char *)&result[k - 1], (ftnlen)
00592 sizeof(real));
00593 e_wsfe();
00594 ++nfail;
00595 }
00596
00597 }
00598 nrun += 5;
00599
00600
00601 }
00602
00603 }
00604
00605
00606
00607
00608
00609 L100:
00610 s_copy(srnamc_1.srnamt, "CPTCON", (ftnlen)32, (ftnlen)6);
00611 cptcon_(&n, &d__[n + 1], &e[n + 1], &anorm, &rcond, &rwork[1], &
00612 info);
00613
00614
00615
00616 if (info != 0) {
00617 alaerh_(path, "CPTCON", &info, &c__0, " ", &n, &n, &c_n1, &
00618 c_n1, &c_n1, &imat, &nfail, &nerrs, nout);
00619 }
00620
00621 result[6] = sget06_(&rcond, &rcondc);
00622
00623
00624
00625 if (result[6] >= *thresh) {
00626 if (nfail == 0 && nerrs == 0) {
00627 alahd_(nout, path);
00628 }
00629 io___40.ciunit = *nout;
00630 s_wsfe(&io___40);
00631 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00632 do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(integer));
00633 do_fio(&c__1, (char *)&c__7, (ftnlen)sizeof(integer));
00634 do_fio(&c__1, (char *)&result[6], (ftnlen)sizeof(real));
00635 e_wsfe();
00636 ++nfail;
00637 }
00638 ++nrun;
00639 L110:
00640 ;
00641 }
00642
00643 }
00644
00645
00646
00647 alasum_(path, nout, &nfail, &nrun, &nerrs);
00648
00649 return 0;
00650
00651
00652
00653 }