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