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