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