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, iounit;
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__1 = 1;
00034 static integer c__0 = 0;
00035 static integer c_n1 = -1;
00036 static integer c__2 = 2;
00037 static integer c__3 = 3;
00038 static integer c__7 = 7;
00039 static integer c__4 = 4;
00040 static real c_b103 = 1.f;
00041 static integer c__8 = 8;
00042 static integer c__9 = 9;
00043
00044 int cchktp_(logical *dotype, integer *nn, integer *nval,
00045 integer *nns, integer *nsval, real *thresh, logical *tsterr, integer *
00046 nmax, complex *ap, complex *ainvp, complex *b, complex *x, complex *
00047 xact, complex *work, real *rwork, integer *nout)
00048 {
00049
00050
00051 static integer iseedy[4] = { 1988,1989,1990,1991 };
00052 static char uplos[1*2] = "U" "L";
00053 static char transs[1*3] = "N" "T" "C";
00054
00055
00056 static char fmt_9999[] = "(\002 UPLO='\002,a1,\002', DIAG='\002,a1,\002'"
00057 ", N=\002,i5,\002, type \002,i2,\002, test(\002,i2,\002)= \002,g1"
00058 "2.5)";
00059 static char fmt_9998[] = "(\002 UPLO='\002,a1,\002', TRANS='\002,a1,\002"
00060 "', DIAG='\002,a1,\002', N=\002,i5,\002', NRHS=\002,i5,\002, type "
00061 "\002,i2,\002, test(\002,i2,\002)= \002,g12.5)";
00062 static char fmt_9997[] = "(1x,a,\002( '\002,a1,\002', '\002,a1,\002', "
00063 "'\002,a1,\002',\002,i5,\002, ... ), type \002,i2,\002, test(\002"
00064 ",i2,\002)=\002,g12.5)";
00065 static char fmt_9996[] = "(1x,a,\002( '\002,a1,\002', '\002,a1,\002', "
00066 "'\002,a1,\002', '\002,a1,\002',\002,i5,\002, ... ), type \002,i2,"
00067 "\002, test(\002,i2,\002)=\002,g12.5)";
00068
00069
00070 address a__1[2], a__2[3], a__3[4];
00071 integer i__1, i__2[2], i__3, i__4[3], i__5[4];
00072 char ch__1[2], ch__2[3], ch__3[4];
00073
00074
00075 int s_copy(char *, char *, ftnlen, ftnlen), s_cat(char *,
00076 char **, integer *, integer *, ftnlen);
00077 integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
00078
00079
00080 integer i__, k, n, in, lda, lap;
00081 char diag[1];
00082 integer imat, info;
00083 char path[3];
00084 integer irhs, nrhs;
00085 char norm[1], uplo[1];
00086 integer nrun;
00087 extern int alahd_(integer *, char *);
00088 integer idiag;
00089 extern int cget04_(integer *, integer *, complex *,
00090 integer *, complex *, integer *, real *, real *);
00091 real scale;
00092 integer nfail, iseed[4];
00093 extern logical lsame_(char *, char *);
00094 real rcond;
00095 extern int ctpt01_(char *, char *, integer *, complex *,
00096 complex *, real *, real *, real *);
00097 real anorm;
00098 integer itran;
00099 extern int ccopy_(integer *, complex *, integer *,
00100 complex *, integer *), ctpt02_(char *, char *, char *, integer *,
00101 integer *, complex *, complex *, integer *, complex *, integer *,
00102 complex *, real *, real *), ctpt03_(char *
00103 , char *, char *, integer *, integer *, complex *, real *, real *,
00104 real *, complex *, integer *, complex *, integer *, complex *,
00105 real *), ctpt05_(char *, char *, char *,
00106 integer *, integer *, complex *, complex *, integer *, complex *,
00107 integer *, complex *, integer *, real *, real *, real *), ctpt06_(real *, real *, char *, char *, integer *
00108 , complex *, real *, real *);
00109 char trans[1];
00110 integer iuplo, nerrs;
00111 char xtype[1];
00112 extern int alaerh_(char *, char *, integer *, integer *,
00113 char *, integer *, integer *, integer *, integer *, integer *,
00114 integer *, integer *, integer *, integer *);
00115 real rcondc;
00116 extern int clacpy_(char *, integer *, integer *, complex
00117 *, integer *, complex *, integer *), clarhs_(char *, char
00118 *, char *, char *, integer *, integer *, integer *, integer *,
00119 integer *, complex *, integer *, complex *, integer *, complex *,
00120 integer *, integer *, integer *);
00121 real rcondi;
00122 extern doublereal clantp_(char *, char *, char *, integer *, complex *,
00123 real *);
00124 extern int alasum_(char *, integer *, integer *, integer
00125 *, integer *);
00126 real rcondo;
00127 extern int clatps_(char *, char *, char *, char *,
00128 integer *, complex *, complex *, real *, real *, integer *), clattp_(integer *, char *, char *
00129 , char *, integer *, integer *, complex *, complex *, complex *,
00130 real *, integer *);
00131 real ainvnm;
00132 extern int ctpcon_(char *, char *, char *, integer *,
00133 complex *, real *, complex *, real *, integer *), cerrtr_(char *, integer *), ctprfs_(char *, char
00134 *, char *, integer *, integer *, complex *, complex *, integer *,
00135 complex *, integer *, real *, real *, complex *, real *, integer *
00136 ), ctptri_(char *, char *, integer *,
00137 complex *, integer *);
00138 real result[9];
00139 extern int ctptrs_(char *, char *, char *, integer *,
00140 integer *, complex *, complex *, integer *, integer *);
00141
00142
00143 static cilist io___26 = { 0, 0, 0, fmt_9999, 0 };
00144 static cilist io___34 = { 0, 0, 0, fmt_9998, 0 };
00145 static cilist io___36 = { 0, 0, 0, fmt_9997, 0 };
00146 static cilist io___38 = { 0, 0, 0, fmt_9996, 0 };
00147 static cilist io___39 = { 0, 0, 0, fmt_9996, 0 };
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 --rwork;
00238 --work;
00239 --xact;
00240 --x;
00241 --b;
00242 --ainvp;
00243 --ap;
00244 --nsval;
00245 --nval;
00246 --dotype;
00247
00248
00249
00250
00251
00252
00253
00254 s_copy(path, "Complex precision", (ftnlen)1, (ftnlen)17);
00255 s_copy(path + 1, "TP", (ftnlen)2, (ftnlen)2);
00256 nrun = 0;
00257 nfail = 0;
00258 nerrs = 0;
00259 for (i__ = 1; i__ <= 4; ++i__) {
00260 iseed[i__ - 1] = iseedy[i__ - 1];
00261
00262 }
00263
00264
00265
00266 if (*tsterr) {
00267 cerrtr_(path, nout);
00268 }
00269 infoc_1.infot = 0;
00270
00271 i__1 = *nn;
00272 for (in = 1; in <= i__1; ++in) {
00273
00274
00275
00276 n = nval[in];
00277 lda = max(1,n);
00278 lap = lda * (lda + 1) / 2;
00279 *(unsigned char *)xtype = 'N';
00280
00281 for (imat = 1; imat <= 10; ++imat) {
00282
00283
00284
00285 if (! dotype[imat]) {
00286 goto L70;
00287 }
00288
00289 for (iuplo = 1; iuplo <= 2; ++iuplo) {
00290
00291
00292
00293 *(unsigned char *)uplo = *(unsigned char *)&uplos[iuplo - 1];
00294
00295
00296
00297 s_copy(srnamc_1.srnamt, "CLATTP", (ftnlen)32, (ftnlen)6);
00298 clattp_(&imat, uplo, "No transpose", diag, iseed, &n, &ap[1],
00299 &x[1], &work[1], &rwork[1], &info);
00300
00301
00302
00303 if (lsame_(diag, "N")) {
00304 idiag = 1;
00305 } else {
00306 idiag = 2;
00307 }
00308
00309
00310
00311
00312 if (n > 0) {
00313 ccopy_(&lap, &ap[1], &c__1, &ainvp[1], &c__1);
00314 }
00315 s_copy(srnamc_1.srnamt, "CTPTRI", (ftnlen)32, (ftnlen)6);
00316 ctptri_(uplo, diag, &n, &ainvp[1], &info);
00317
00318
00319
00320 if (info != 0) {
00321
00322 i__2[0] = 1, a__1[0] = uplo;
00323 i__2[1] = 1, a__1[1] = diag;
00324 s_cat(ch__1, a__1, i__2, &c__2, (ftnlen)2);
00325 alaerh_(path, "CTPTRI", &info, &c__0, ch__1, &n, &n, &
00326 c_n1, &c_n1, &c_n1, &imat, &nfail, &nerrs, nout);
00327 }
00328
00329
00330
00331 anorm = clantp_("I", uplo, diag, &n, &ap[1], &rwork[1]);
00332 ainvnm = clantp_("I", uplo, diag, &n, &ainvp[1], &rwork[1]);
00333 if (anorm <= 0.f || ainvnm <= 0.f) {
00334 rcondi = 1.f;
00335 } else {
00336 rcondi = 1.f / anorm / ainvnm;
00337 }
00338
00339
00340
00341
00342 ctpt01_(uplo, diag, &n, &ap[1], &ainvp[1], &rcondo, &rwork[1],
00343 result);
00344
00345
00346
00347 if (result[0] >= *thresh) {
00348 if (nfail == 0 && nerrs == 0) {
00349 alahd_(nout, path);
00350 }
00351 io___26.ciunit = *nout;
00352 s_wsfe(&io___26);
00353 do_fio(&c__1, uplo, (ftnlen)1);
00354 do_fio(&c__1, diag, (ftnlen)1);
00355 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00356 do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(integer));
00357 do_fio(&c__1, (char *)&c__1, (ftnlen)sizeof(integer));
00358 do_fio(&c__1, (char *)&result[0], (ftnlen)sizeof(real));
00359 e_wsfe();
00360 ++nfail;
00361 }
00362 ++nrun;
00363
00364 i__3 = *nns;
00365 for (irhs = 1; irhs <= i__3; ++irhs) {
00366 nrhs = nsval[irhs];
00367 *(unsigned char *)xtype = 'N';
00368
00369 for (itran = 1; itran <= 3; ++itran) {
00370
00371
00372
00373 *(unsigned char *)trans = *(unsigned char *)&transs[
00374 itran - 1];
00375 if (itran == 1) {
00376 *(unsigned char *)norm = 'O';
00377 rcondc = rcondo;
00378 } else {
00379 *(unsigned char *)norm = 'I';
00380 rcondc = rcondi;
00381 }
00382
00383
00384
00385
00386 s_copy(srnamc_1.srnamt, "CLARHS", (ftnlen)32, (ftnlen)
00387 6);
00388 clarhs_(path, xtype, uplo, trans, &n, &n, &c__0, &
00389 idiag, &nrhs, &ap[1], &lap, &xact[1], &lda, &
00390 b[1], &lda, iseed, &info);
00391 *(unsigned char *)xtype = 'C';
00392 clacpy_("Full", &n, &nrhs, &b[1], &lda, &x[1], &lda);
00393
00394 s_copy(srnamc_1.srnamt, "CTPTRS", (ftnlen)32, (ftnlen)
00395 6);
00396 ctptrs_(uplo, trans, diag, &n, &nrhs, &ap[1], &x[1], &
00397 lda, &info);
00398
00399
00400
00401 if (info != 0) {
00402
00403 i__4[0] = 1, a__2[0] = uplo;
00404 i__4[1] = 1, a__2[1] = trans;
00405 i__4[2] = 1, a__2[2] = diag;
00406 s_cat(ch__2, a__2, i__4, &c__3, (ftnlen)3);
00407 alaerh_(path, "CTPTRS", &info, &c__0, ch__2, &n, &
00408 n, &c_n1, &c_n1, &c_n1, &imat, &nfail, &
00409 nerrs, nout);
00410 }
00411
00412 ctpt02_(uplo, trans, diag, &n, &nrhs, &ap[1], &x[1], &
00413 lda, &b[1], &lda, &work[1], &rwork[1], &
00414 result[1]);
00415
00416
00417
00418
00419 cget04_(&n, &nrhs, &x[1], &lda, &xact[1], &lda, &
00420 rcondc, &result[2]);
00421
00422
00423
00424
00425
00426 s_copy(srnamc_1.srnamt, "CTPRFS", (ftnlen)32, (ftnlen)
00427 6);
00428 ctprfs_(uplo, trans, diag, &n, &nrhs, &ap[1], &b[1], &
00429 lda, &x[1], &lda, &rwork[1], &rwork[nrhs + 1],
00430 &work[1], &rwork[(nrhs << 1) + 1], &info);
00431
00432
00433
00434 if (info != 0) {
00435
00436 i__4[0] = 1, a__2[0] = uplo;
00437 i__4[1] = 1, a__2[1] = trans;
00438 i__4[2] = 1, a__2[2] = diag;
00439 s_cat(ch__2, a__2, i__4, &c__3, (ftnlen)3);
00440 alaerh_(path, "CTPRFS", &info, &c__0, ch__2, &n, &
00441 n, &c_n1, &c_n1, &nrhs, &imat, &nfail, &
00442 nerrs, nout);
00443 }
00444
00445 cget04_(&n, &nrhs, &x[1], &lda, &xact[1], &lda, &
00446 rcondc, &result[3]);
00447 ctpt05_(uplo, trans, diag, &n, &nrhs, &ap[1], &b[1], &
00448 lda, &x[1], &lda, &xact[1], &lda, &rwork[1], &
00449 rwork[nrhs + 1], &result[4]);
00450
00451
00452
00453
00454 for (k = 2; k <= 6; ++k) {
00455 if (result[k - 1] >= *thresh) {
00456 if (nfail == 0 && nerrs == 0) {
00457 alahd_(nout, path);
00458 }
00459 io___34.ciunit = *nout;
00460 s_wsfe(&io___34);
00461 do_fio(&c__1, uplo, (ftnlen)1);
00462 do_fio(&c__1, trans, (ftnlen)1);
00463 do_fio(&c__1, diag, (ftnlen)1);
00464 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(
00465 integer));
00466 do_fio(&c__1, (char *)&nrhs, (ftnlen)sizeof(
00467 integer));
00468 do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(
00469 integer));
00470 do_fio(&c__1, (char *)&k, (ftnlen)sizeof(
00471 integer));
00472 do_fio(&c__1, (char *)&result[k - 1], (ftnlen)
00473 sizeof(real));
00474 e_wsfe();
00475 ++nfail;
00476 }
00477
00478 }
00479 nrun += 5;
00480
00481 }
00482
00483 }
00484
00485
00486
00487
00488 for (itran = 1; itran <= 2; ++itran) {
00489 if (itran == 1) {
00490 *(unsigned char *)norm = 'O';
00491 rcondc = rcondo;
00492 } else {
00493 *(unsigned char *)norm = 'I';
00494 rcondc = rcondi;
00495 }
00496 s_copy(srnamc_1.srnamt, "CTPCON", (ftnlen)32, (ftnlen)6);
00497 ctpcon_(norm, uplo, diag, &n, &ap[1], &rcond, &work[1], &
00498 rwork[1], &info);
00499
00500
00501
00502 if (info != 0) {
00503
00504 i__4[0] = 1, a__2[0] = norm;
00505 i__4[1] = 1, a__2[1] = uplo;
00506 i__4[2] = 1, a__2[2] = diag;
00507 s_cat(ch__2, a__2, i__4, &c__3, (ftnlen)3);
00508 alaerh_(path, "CTPCON", &info, &c__0, ch__2, &n, &n, &
00509 c_n1, &c_n1, &c_n1, &imat, &nfail, &nerrs,
00510 nout);
00511 }
00512
00513 ctpt06_(&rcond, &rcondc, uplo, diag, &n, &ap[1], &rwork[1]
00514 , &result[6]);
00515
00516
00517
00518 if (result[6] >= *thresh) {
00519 if (nfail == 0 && nerrs == 0) {
00520 alahd_(nout, path);
00521 }
00522 io___36.ciunit = *nout;
00523 s_wsfe(&io___36);
00524 do_fio(&c__1, "CTPCON", (ftnlen)6);
00525 do_fio(&c__1, norm, (ftnlen)1);
00526 do_fio(&c__1, uplo, (ftnlen)1);
00527 do_fio(&c__1, diag, (ftnlen)1);
00528 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00529 do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(integer));
00530 do_fio(&c__1, (char *)&c__7, (ftnlen)sizeof(integer));
00531 do_fio(&c__1, (char *)&result[6], (ftnlen)sizeof(real)
00532 );
00533 e_wsfe();
00534 ++nfail;
00535 }
00536 ++nrun;
00537
00538 }
00539
00540 }
00541 L70:
00542 ;
00543 }
00544
00545
00546
00547 for (imat = 11; imat <= 18; ++imat) {
00548
00549
00550
00551 if (! dotype[imat]) {
00552 goto L100;
00553 }
00554
00555 for (iuplo = 1; iuplo <= 2; ++iuplo) {
00556
00557
00558
00559 *(unsigned char *)uplo = *(unsigned char *)&uplos[iuplo - 1];
00560 for (itran = 1; itran <= 3; ++itran) {
00561
00562
00563
00564 *(unsigned char *)trans = *(unsigned char *)&transs[itran
00565 - 1];
00566
00567
00568
00569 s_copy(srnamc_1.srnamt, "CLATTP", (ftnlen)32, (ftnlen)6);
00570 clattp_(&imat, uplo, trans, diag, iseed, &n, &ap[1], &x[1]
00571 , &work[1], &rwork[1], &info);
00572
00573
00574
00575
00576 s_copy(srnamc_1.srnamt, "CLATPS", (ftnlen)32, (ftnlen)6);
00577 ccopy_(&n, &x[1], &c__1, &b[1], &c__1);
00578 clatps_(uplo, trans, diag, "N", &n, &ap[1], &b[1], &scale,
00579 &rwork[1], &info);
00580
00581
00582
00583 if (info != 0) {
00584
00585 i__5[0] = 1, a__3[0] = uplo;
00586 i__5[1] = 1, a__3[1] = trans;
00587 i__5[2] = 1, a__3[2] = diag;
00588 i__5[3] = 1, a__3[3] = "N";
00589 s_cat(ch__3, a__3, i__5, &c__4, (ftnlen)4);
00590 alaerh_(path, "CLATPS", &info, &c__0, ch__3, &n, &n, &
00591 c_n1, &c_n1, &c_n1, &imat, &nfail, &nerrs,
00592 nout);
00593 }
00594
00595 ctpt03_(uplo, trans, diag, &n, &c__1, &ap[1], &scale, &
00596 rwork[1], &c_b103, &b[1], &lda, &x[1], &lda, &
00597 work[1], &result[7]);
00598
00599
00600
00601
00602 ccopy_(&n, &x[1], &c__1, &b[n + 1], &c__1);
00603 clatps_(uplo, trans, diag, "Y", &n, &ap[1], &b[n + 1], &
00604 scale, &rwork[1], &info);
00605
00606
00607
00608 if (info != 0) {
00609
00610 i__5[0] = 1, a__3[0] = uplo;
00611 i__5[1] = 1, a__3[1] = trans;
00612 i__5[2] = 1, a__3[2] = diag;
00613 i__5[3] = 1, a__3[3] = "Y";
00614 s_cat(ch__3, a__3, i__5, &c__4, (ftnlen)4);
00615 alaerh_(path, "CLATPS", &info, &c__0, ch__3, &n, &n, &
00616 c_n1, &c_n1, &c_n1, &imat, &nfail, &nerrs,
00617 nout);
00618 }
00619
00620 ctpt03_(uplo, trans, diag, &n, &c__1, &ap[1], &scale, &
00621 rwork[1], &c_b103, &b[n + 1], &lda, &x[1], &lda, &
00622 work[1], &result[8]);
00623
00624
00625
00626
00627 if (result[7] >= *thresh) {
00628 if (nfail == 0 && nerrs == 0) {
00629 alahd_(nout, path);
00630 }
00631 io___38.ciunit = *nout;
00632 s_wsfe(&io___38);
00633 do_fio(&c__1, "CLATPS", (ftnlen)6);
00634 do_fio(&c__1, uplo, (ftnlen)1);
00635 do_fio(&c__1, trans, (ftnlen)1);
00636 do_fio(&c__1, diag, (ftnlen)1);
00637 do_fio(&c__1, "N", (ftnlen)1);
00638 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00639 do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(integer));
00640 do_fio(&c__1, (char *)&c__8, (ftnlen)sizeof(integer));
00641 do_fio(&c__1, (char *)&result[7], (ftnlen)sizeof(real)
00642 );
00643 e_wsfe();
00644 ++nfail;
00645 }
00646 if (result[8] >= *thresh) {
00647 if (nfail == 0 && nerrs == 0) {
00648 alahd_(nout, path);
00649 }
00650 io___39.ciunit = *nout;
00651 s_wsfe(&io___39);
00652 do_fio(&c__1, "CLATPS", (ftnlen)6);
00653 do_fio(&c__1, uplo, (ftnlen)1);
00654 do_fio(&c__1, trans, (ftnlen)1);
00655 do_fio(&c__1, diag, (ftnlen)1);
00656 do_fio(&c__1, "Y", (ftnlen)1);
00657 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00658 do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(integer));
00659 do_fio(&c__1, (char *)&c__9, (ftnlen)sizeof(integer));
00660 do_fio(&c__1, (char *)&result[8], (ftnlen)sizeof(real)
00661 );
00662 e_wsfe();
00663 ++nfail;
00664 }
00665 nrun += 2;
00666
00667 }
00668
00669 }
00670 L100:
00671 ;
00672 }
00673
00674 }
00675
00676
00677
00678 alasum_(path, nout, &nfail, &nrun, &nerrs);
00679
00680 return 0;
00681
00682
00683
00684 }