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