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__0 = 0;
00034 static integer c_n1 = -1;
00035 static integer c__2 = 2;
00036 static integer c__1 = 1;
00037 static integer c__8 = 8;
00038
00039 int cchkpp_(logical *dotype, integer *nn, integer *nval,
00040 integer *nns, integer *nsval, real *thresh, logical *tsterr, integer *
00041 nmax, complex *a, complex *afac, complex *ainv, complex *b, complex *
00042 x, complex *xact, complex *work, real *rwork, integer *nout)
00043 {
00044
00045
00046 static integer iseedy[4] = { 1988,1989,1990,1991 };
00047 static char uplos[1*2] = "U" "L";
00048 static char packs[1*2] = "C" "R";
00049
00050
00051 static char fmt_9999[] = "(\002 UPLO = '\002,a1,\002', N =\002,i5,\002, "
00052 "type \002,i2,\002, test \002,i2,\002, ratio =\002,g12.5)";
00053 static char fmt_9998[] = "(\002 UPLO = '\002,a1,\002', N =\002,i5,\002, "
00054 "NRHS=\002,i3,\002, type \002,i2,\002, test(\002,i2,\002) =\002,g"
00055 "12.5)";
00056
00057
00058 integer i__1, i__2, i__3, i__4;
00059
00060
00061 int s_copy(char *, char *, ftnlen, ftnlen);
00062 integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
00063
00064
00065 integer i__, k, n, in, kl, ku, lda, npp, ioff, mode, imat, info;
00066 char path[3], dist[1];
00067 integer irhs, nrhs;
00068 char uplo[1], type__[1];
00069 integer nrun;
00070 extern int alahd_(integer *, char *), cget04_(
00071 integer *, integer *, complex *, integer *, complex *, integer *,
00072 real *, real *);
00073 integer nfail, iseed[4];
00074 real rcond;
00075 extern int cppt01_(char *, integer *, complex *, complex
00076 *, real *, real *);
00077 integer nimat;
00078 extern doublereal sget06_(real *, real *);
00079 extern int cppt02_(char *, integer *, integer *, complex
00080 *, complex *, integer *, complex *, integer *, real *, real *), cppt03_(char *, integer *, complex *, complex *, complex
00081 *, integer *, real *, real *, real *);
00082 real anorm;
00083 extern int ccopy_(integer *, complex *, integer *,
00084 complex *, integer *), cppt05_(char *, integer *, integer *,
00085 complex *, complex *, integer *, complex *, integer *, complex *,
00086 integer *, real *, real *, real *);
00087 integer iuplo, izero, nerrs;
00088 logical zerot;
00089 char xtype[1];
00090 extern int clatb4_(char *, integer *, integer *, integer
00091 *, char *, integer *, integer *, real *, integer *, real *, char *
00092 ), alaerh_(char *, char *, integer *,
00093 integer *, char *, integer *, integer *, integer *, integer *,
00094 integer *, integer *, integer *, integer *, integer *), claipd_(integer *, complex *, integer *, integer
00095 *);
00096 extern doublereal clanhp_(char *, char *, integer *, complex *, real *);
00097 real rcondc;
00098 char packit[1];
00099 extern int clacpy_(char *, integer *, integer *, complex
00100 *, integer *, complex *, integer *), clarhs_(char *, char
00101 *, char *, char *, integer *, integer *, integer *, integer *,
00102 integer *, complex *, integer *, complex *, integer *, complex *,
00103 integer *, integer *, integer *),
00104 alasum_(char *, integer *, integer *, integer *, integer *);
00105 real cndnum;
00106 extern int clatms_(integer *, integer *, char *, integer
00107 *, char *, real *, integer *, real *, real *, integer *, integer *
00108 , char *, complex *, integer *, complex *, integer *), cppcon_(char *, integer *, complex *, real *,
00109 real *, complex *, real *, integer *), cerrpo_(char *,
00110 integer *), cpprfs_(char *, integer *, integer *, complex
00111 *, complex *, complex *, integer *, complex *, integer *, real *,
00112 real *, complex *, real *, integer *), cpptrf_(char *,
00113 integer *, complex *, integer *), cpptri_(char *, integer
00114 *, complex *, integer *), cpptrs_(char *, integer *,
00115 integer *, complex *, complex *, integer *, integer *);
00116 real result[8];
00117
00118
00119 static cilist io___34 = { 0, 0, 0, fmt_9999, 0 };
00120 static cilist io___37 = { 0, 0, 0, fmt_9998, 0 };
00121 static cilist io___39 = { 0, 0, 0, fmt_9999, 0 };
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
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 --rwork;
00217 --work;
00218 --xact;
00219 --x;
00220 --b;
00221 --ainv;
00222 --afac;
00223 --a;
00224 --nsval;
00225 --nval;
00226 --dotype;
00227
00228
00229
00230
00231
00232
00233
00234 s_copy(path, "Complex precision", (ftnlen)1, (ftnlen)17);
00235 s_copy(path + 1, "PP", (ftnlen)2, (ftnlen)2);
00236 nrun = 0;
00237 nfail = 0;
00238 nerrs = 0;
00239 for (i__ = 1; i__ <= 4; ++i__) {
00240 iseed[i__ - 1] = iseedy[i__ - 1];
00241
00242 }
00243
00244
00245
00246 if (*tsterr) {
00247 cerrpo_(path, nout);
00248 }
00249 infoc_1.infot = 0;
00250
00251
00252
00253 i__1 = *nn;
00254 for (in = 1; in <= i__1; ++in) {
00255 n = nval[in];
00256 lda = max(n,1);
00257 *(unsigned char *)xtype = 'N';
00258 nimat = 9;
00259 if (n <= 0) {
00260 nimat = 1;
00261 }
00262
00263 i__2 = nimat;
00264 for (imat = 1; imat <= i__2; ++imat) {
00265
00266
00267
00268 if (! dotype[imat]) {
00269 goto L100;
00270 }
00271
00272
00273
00274 zerot = imat >= 3 && imat <= 5;
00275 if (zerot && n < imat - 2) {
00276 goto L100;
00277 }
00278
00279
00280
00281 for (iuplo = 1; iuplo <= 2; ++iuplo) {
00282 *(unsigned char *)uplo = *(unsigned char *)&uplos[iuplo - 1];
00283 *(unsigned char *)packit = *(unsigned char *)&packs[iuplo - 1]
00284 ;
00285
00286
00287
00288
00289 clatb4_(path, &imat, &n, &n, type__, &kl, &ku, &anorm, &mode,
00290 &cndnum, dist);
00291
00292 s_copy(srnamc_1.srnamt, "CLATMS", (ftnlen)32, (ftnlen)6);
00293 clatms_(&n, &n, dist, iseed, type__, &rwork[1], &mode, &
00294 cndnum, &anorm, &kl, &ku, packit, &a[1], &lda, &work[
00295 1], &info);
00296
00297
00298
00299 if (info != 0) {
00300 alaerh_(path, "CLATMS", &info, &c__0, uplo, &n, &n, &c_n1,
00301 &c_n1, &c_n1, &imat, &nfail, &nerrs, nout);
00302 goto L90;
00303 }
00304
00305
00306
00307
00308 if (zerot) {
00309 if (imat == 3) {
00310 izero = 1;
00311 } else if (imat == 4) {
00312 izero = n;
00313 } else {
00314 izero = n / 2 + 1;
00315 }
00316
00317
00318
00319 if (iuplo == 1) {
00320 ioff = (izero - 1) * izero / 2;
00321 i__3 = izero - 1;
00322 for (i__ = 1; i__ <= i__3; ++i__) {
00323 i__4 = ioff + i__;
00324 a[i__4].r = 0.f, a[i__4].i = 0.f;
00325
00326 }
00327 ioff += izero;
00328 i__3 = n;
00329 for (i__ = izero; i__ <= i__3; ++i__) {
00330 i__4 = ioff;
00331 a[i__4].r = 0.f, a[i__4].i = 0.f;
00332 ioff += i__;
00333
00334 }
00335 } else {
00336 ioff = izero;
00337 i__3 = izero - 1;
00338 for (i__ = 1; i__ <= i__3; ++i__) {
00339 i__4 = ioff;
00340 a[i__4].r = 0.f, a[i__4].i = 0.f;
00341 ioff = ioff + n - i__;
00342
00343 }
00344 ioff -= izero;
00345 i__3 = n;
00346 for (i__ = izero; i__ <= i__3; ++i__) {
00347 i__4 = ioff + i__;
00348 a[i__4].r = 0.f, a[i__4].i = 0.f;
00349
00350 }
00351 }
00352 } else {
00353 izero = 0;
00354 }
00355
00356
00357
00358 if (iuplo == 1) {
00359 claipd_(&n, &a[1], &c__2, &c__1);
00360 } else {
00361 claipd_(&n, &a[1], &n, &c_n1);
00362 }
00363
00364
00365
00366 npp = n * (n + 1) / 2;
00367 ccopy_(&npp, &a[1], &c__1, &afac[1], &c__1);
00368 s_copy(srnamc_1.srnamt, "CPPTRF", (ftnlen)32, (ftnlen)6);
00369 cpptrf_(uplo, &n, &afac[1], &info);
00370
00371
00372
00373 if (info != izero) {
00374 alaerh_(path, "CPPTRF", &info, &izero, uplo, &n, &n, &
00375 c_n1, &c_n1, &c_n1, &imat, &nfail, &nerrs, nout);
00376 goto L90;
00377 }
00378
00379
00380
00381 if (info != 0) {
00382 goto L90;
00383 }
00384
00385
00386
00387
00388 ccopy_(&npp, &afac[1], &c__1, &ainv[1], &c__1);
00389 cppt01_(uplo, &n, &a[1], &ainv[1], &rwork[1], result);
00390
00391
00392
00393
00394 ccopy_(&npp, &afac[1], &c__1, &ainv[1], &c__1);
00395 s_copy(srnamc_1.srnamt, "CPPTRI", (ftnlen)32, (ftnlen)6);
00396 cpptri_(uplo, &n, &ainv[1], &info);
00397
00398
00399
00400 if (info != 0) {
00401 alaerh_(path, "CPPTRI", &info, &c__0, uplo, &n, &n, &c_n1,
00402 &c_n1, &c_n1, &imat, &nfail, &nerrs, nout);
00403 }
00404
00405 cppt03_(uplo, &n, &a[1], &ainv[1], &work[1], &lda, &rwork[1],
00406 &rcondc, &result[1]);
00407
00408
00409
00410
00411 for (k = 1; k <= 2; ++k) {
00412 if (result[k - 1] >= *thresh) {
00413 if (nfail == 0 && nerrs == 0) {
00414 alahd_(nout, path);
00415 }
00416 io___34.ciunit = *nout;
00417 s_wsfe(&io___34);
00418 do_fio(&c__1, uplo, (ftnlen)1);
00419 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00420 do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(integer));
00421 do_fio(&c__1, (char *)&k, (ftnlen)sizeof(integer));
00422 do_fio(&c__1, (char *)&result[k - 1], (ftnlen)sizeof(
00423 real));
00424 e_wsfe();
00425 ++nfail;
00426 }
00427
00428 }
00429 nrun += 2;
00430
00431 i__3 = *nns;
00432 for (irhs = 1; irhs <= i__3; ++irhs) {
00433 nrhs = nsval[irhs];
00434
00435
00436
00437
00438 s_copy(srnamc_1.srnamt, "CLARHS", (ftnlen)32, (ftnlen)6);
00439 clarhs_(path, xtype, uplo, " ", &n, &n, &kl, &ku, &nrhs, &
00440 a[1], &lda, &xact[1], &lda, &b[1], &lda, iseed, &
00441 info);
00442 clacpy_("Full", &n, &nrhs, &b[1], &lda, &x[1], &lda);
00443
00444 s_copy(srnamc_1.srnamt, "CPPTRS", (ftnlen)32, (ftnlen)6);
00445 cpptrs_(uplo, &n, &nrhs, &afac[1], &x[1], &lda, &info);
00446
00447
00448
00449 if (info != 0) {
00450 alaerh_(path, "CPPTRS", &info, &c__0, uplo, &n, &n, &
00451 c_n1, &c_n1, &nrhs, &imat, &nfail, &nerrs,
00452 nout);
00453 }
00454
00455 clacpy_("Full", &n, &nrhs, &b[1], &lda, &work[1], &lda);
00456 cppt02_(uplo, &n, &nrhs, &a[1], &x[1], &lda, &work[1], &
00457 lda, &rwork[1], &result[2]);
00458
00459
00460
00461
00462 cget04_(&n, &nrhs, &x[1], &lda, &xact[1], &lda, &rcondc, &
00463 result[3]);
00464
00465
00466
00467
00468 s_copy(srnamc_1.srnamt, "CPPRFS", (ftnlen)32, (ftnlen)6);
00469 cpprfs_(uplo, &n, &nrhs, &a[1], &afac[1], &b[1], &lda, &x[
00470 1], &lda, &rwork[1], &rwork[nrhs + 1], &work[1], &
00471 rwork[(nrhs << 1) + 1], &info);
00472
00473
00474
00475 if (info != 0) {
00476 alaerh_(path, "CPPRFS", &info, &c__0, uplo, &n, &n, &
00477 c_n1, &c_n1, &nrhs, &imat, &nfail, &nerrs,
00478 nout);
00479 }
00480
00481 cget04_(&n, &nrhs, &x[1], &lda, &xact[1], &lda, &rcondc, &
00482 result[4]);
00483 cppt05_(uplo, &n, &nrhs, &a[1], &b[1], &lda, &x[1], &lda,
00484 &xact[1], &lda, &rwork[1], &rwork[nrhs + 1], &
00485 result[5]);
00486
00487
00488
00489
00490 for (k = 3; k <= 7; ++k) {
00491 if (result[k - 1] >= *thresh) {
00492 if (nfail == 0 && nerrs == 0) {
00493 alahd_(nout, path);
00494 }
00495 io___37.ciunit = *nout;
00496 s_wsfe(&io___37);
00497 do_fio(&c__1, uplo, (ftnlen)1);
00498 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer))
00499 ;
00500 do_fio(&c__1, (char *)&nrhs, (ftnlen)sizeof(
00501 integer));
00502 do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(
00503 integer));
00504 do_fio(&c__1, (char *)&k, (ftnlen)sizeof(integer))
00505 ;
00506 do_fio(&c__1, (char *)&result[k - 1], (ftnlen)
00507 sizeof(real));
00508 e_wsfe();
00509 ++nfail;
00510 }
00511
00512 }
00513 nrun += 5;
00514
00515 }
00516
00517
00518
00519
00520 anorm = clanhp_("1", uplo, &n, &a[1], &rwork[1]);
00521 s_copy(srnamc_1.srnamt, "CPPCON", (ftnlen)32, (ftnlen)6);
00522 cppcon_(uplo, &n, &afac[1], &anorm, &rcond, &work[1], &rwork[
00523 1], &info);
00524
00525
00526
00527 if (info != 0) {
00528 alaerh_(path, "CPPCON", &info, &c__0, uplo, &n, &n, &c_n1,
00529 &c_n1, &c_n1, &imat, &nfail, &nerrs, nout);
00530 }
00531
00532 result[7] = sget06_(&rcond, &rcondc);
00533
00534
00535
00536 if (result[7] >= *thresh) {
00537 if (nfail == 0 && nerrs == 0) {
00538 alahd_(nout, path);
00539 }
00540 io___39.ciunit = *nout;
00541 s_wsfe(&io___39);
00542 do_fio(&c__1, uplo, (ftnlen)1);
00543 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00544 do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(integer));
00545 do_fio(&c__1, (char *)&c__8, (ftnlen)sizeof(integer));
00546 do_fio(&c__1, (char *)&result[7], (ftnlen)sizeof(real));
00547 e_wsfe();
00548 ++nfail;
00549 }
00550 ++nrun;
00551
00552 L90:
00553 ;
00554 }
00555 L100:
00556 ;
00557 }
00558
00559 }
00560
00561
00562
00563 alasum_(path, nout, &nfail, &nrun, &nerrs);
00564
00565 return 0;
00566
00567
00568
00569 }