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