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