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_b46 = 1.f;
00038 static real c_b47 = 0.f;
00039 static integer c__7 = 7;
00040
00041 int schkpt_(logical *dotype, integer *nn, integer *nval,
00042 integer *nns, integer *nsval, real *thresh, logical *tsterr, real *a,
00043 real *d__, real *e, real *b, real *x, real *xact, real *work, real *
00044 rwork, integer *nout)
00045 {
00046
00047
00048 static integer iseedy[4] = { 0,0,0,1 };
00049
00050
00051 static char fmt_9999[] = "(\002 N =\002,i5,\002, type \002,i2,\002, te"
00052 "st \002,i2,\002, ratio = \002,g12.5)";
00053 static char fmt_9998[] = "(\002 N =\002,i5,\002, NRHS=\002,i3,\002, ty"
00054 "pe \002,i2,\002, test(\002,i2,\002) = \002,g12.5)";
00055
00056
00057 integer i__1, i__2, i__3, i__4;
00058 real r__1, r__2, r__3;
00059
00060
00061 int s_copy(char *, char *, ftnlen, ftnlen);
00062 integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
00063
00064
00065 integer i__, j, k, n;
00066 real z__[3];
00067 integer ia, in, kl, ku, ix, lda;
00068 real cond;
00069 integer mode;
00070 real dmax__;
00071 integer imat, info;
00072 char path[3], dist[1];
00073 integer irhs, nrhs;
00074 char type__[1];
00075 integer nrun;
00076 extern int alahd_(integer *, char *);
00077 integer nfail, iseed[4];
00078 real rcond;
00079 extern int sget04_(integer *, integer *, real *, integer
00080 *, real *, integer *, real *, real *), sscal_(integer *, real *,
00081 real *, integer *);
00082 integer nimat;
00083 extern doublereal sget06_(real *, real *);
00084 real anorm;
00085 integer izero, nerrs;
00086 extern doublereal sasum_(integer *, real *, integer *);
00087 extern int sptt01_(integer *, real *, real *, real *,
00088 real *, real *, real *), sptt02_(integer *, integer *, real *,
00089 real *, real *, integer *, real *, integer *, real *), scopy_(
00090 integer *, real *, integer *, real *, integer *), sptt05_(integer
00091 *, integer *, real *, real *, real *, integer *, real *, integer *
00092 , real *, integer *, real *, real *, real *);
00093 logical zerot;
00094 extern int slatb4_(char *, integer *, integer *, integer
00095 *, char *, integer *, integer *, real *, integer *, real *, char *
00096 ), alaerh_(char *, char *, integer *,
00097 integer *, char *, integer *, integer *, integer *, integer *,
00098 integer *, integer *, integer *, integer *, integer *);
00099 real rcondc;
00100 extern integer isamax_(integer *, real *, integer *);
00101 extern int alasum_(char *, integer *, integer *, integer
00102 *, integer *);
00103 real ainvnm;
00104 extern int slacpy_(char *, integer *, integer *, real *,
00105 integer *, real *, integer *), slaptm_(integer *, integer
00106 *, real *, real *, real *, real *, integer *, real *, real *,
00107 integer *), slatms_(integer *, integer *, char *, integer *, char
00108 *, real *, integer *, real *, real *, integer *, integer *, char *
00109 , real *, integer *, real *, integer *);
00110 extern doublereal slanst_(char *, integer *, real *, real *);
00111 extern int serrgt_(char *, integer *), slarnv_(
00112 integer *, integer *, integer *, real *), sptcon_(integer *, real
00113 *, real *, real *, real *, real *, integer *);
00114 real result[7];
00115 extern int sptrfs_(integer *, integer *, real *, real *,
00116 real *, real *, real *, integer *, real *, integer *, real *,
00117 real *, real *, integer *), spttrf_(integer *, real *, real *,
00118 integer *), spttrs_(integer *, integer *, real *, real *, real *,
00119 integer *, integer *);
00120
00121
00122 static cilist io___29 = { 0, 0, 0, fmt_9999, 0 };
00123 static cilist io___35 = { 0, 0, 0, fmt_9998, 0 };
00124 static cilist io___37 = { 0, 0, 0, fmt_9999, 0 };
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
00208
00209
00210
00211
00212 --rwork;
00213 --work;
00214 --xact;
00215 --x;
00216 --b;
00217 --e;
00218 --d__;
00219 --a;
00220 --nsval;
00221 --nval;
00222 --dotype;
00223
00224
00225
00226
00227
00228 s_copy(path, "Single 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 serrgt_(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 L100;
00264 }
00265
00266
00267
00268 slatb4_(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, "SLATMS", (ftnlen)32, (ftnlen)6);
00278 slatms_(&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, "SLATMS", &info, &c__0, " ", &n, &n, &kl, &
00285 ku, &c_n1, &imat, &nfail, &nerrs, nout);
00286 goto L100;
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 slarnv_(&c__2, iseed, &n, &d__[1]);
00313 i__3 = n - 1;
00314 slarnv_(&c__2, iseed, &i__3, &e[1]);
00315
00316
00317
00318 if (n == 1) {
00319 d__[1] = dabs(d__[1]);
00320 } else {
00321 d__[1] = dabs(d__[1]) + dabs(e[1]);
00322 d__[n] = (r__1 = d__[n], dabs(r__1)) + (r__2 = e[n -
00323 1], dabs(r__2));
00324 i__3 = n - 1;
00325 for (i__ = 2; i__ <= i__3; ++i__) {
00326 d__[i__] = (r__1 = d__[i__], dabs(r__1)) + (r__2 =
00327 e[i__], dabs(r__2)) + (r__3 = e[i__ - 1],
00328 dabs(r__3));
00329
00330 }
00331 }
00332
00333
00334
00335 ix = isamax_(&n, &d__[1], &c__1);
00336 dmax__ = d__[ix];
00337 r__1 = anorm / dmax__;
00338 sscal_(&n, &r__1, &d__[1], &c__1);
00339 i__3 = n - 1;
00340 r__1 = anorm / dmax__;
00341 sscal_(&i__3, &r__1, &e[1], &c__1);
00342
00343 } else if (izero > 0) {
00344
00345
00346
00347
00348 if (izero == 1) {
00349 d__[1] = z__[1];
00350 if (n > 1) {
00351 e[1] = z__[2];
00352 }
00353 } else if (izero == n) {
00354 e[n - 1] = z__[0];
00355 d__[n] = z__[1];
00356 } else {
00357 e[izero - 1] = z__[0];
00358 d__[izero] = z__[1];
00359 e[izero] = z__[2];
00360 }
00361 }
00362
00363
00364
00365
00366 izero = 0;
00367 if (imat == 8) {
00368 izero = 1;
00369 z__[1] = d__[1];
00370 d__[1] = 0.f;
00371 if (n > 1) {
00372 z__[2] = e[1];
00373 e[1] = 0.f;
00374 }
00375 } else if (imat == 9) {
00376 izero = n;
00377 if (n > 1) {
00378 z__[0] = e[n - 1];
00379 e[n - 1] = 0.f;
00380 }
00381 z__[1] = d__[n];
00382 d__[n] = 0.f;
00383 } else if (imat == 10) {
00384 izero = (n + 1) / 2;
00385 if (izero > 1) {
00386 z__[0] = e[izero - 1];
00387 e[izero - 1] = 0.f;
00388 z__[2] = e[izero];
00389 e[izero] = 0.f;
00390 }
00391 z__[1] = d__[izero];
00392 d__[izero] = 0.f;
00393 }
00394 }
00395
00396 scopy_(&n, &d__[1], &c__1, &d__[n + 1], &c__1);
00397 if (n > 1) {
00398 i__3 = n - 1;
00399 scopy_(&i__3, &e[1], &c__1, &e[n + 1], &c__1);
00400 }
00401
00402
00403
00404
00405
00406 spttrf_(&n, &d__[n + 1], &e[n + 1], &info);
00407
00408
00409
00410 if (info != izero) {
00411 alaerh_(path, "SPTTRF", &info, &izero, " ", &n, &n, &c_n1, &
00412 c_n1, &c_n1, &imat, &nfail, &nerrs, nout);
00413 goto L100;
00414 }
00415
00416 if (info > 0) {
00417 rcondc = 0.f;
00418 goto L90;
00419 }
00420
00421 sptt01_(&n, &d__[1], &e[1], &d__[n + 1], &e[n + 1], &work[1],
00422 result);
00423
00424
00425
00426 if (result[0] >= *thresh) {
00427 if (nfail == 0 && nerrs == 0) {
00428 alahd_(nout, path);
00429 }
00430 io___29.ciunit = *nout;
00431 s_wsfe(&io___29);
00432 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00433 do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(integer));
00434 do_fio(&c__1, (char *)&c__1, (ftnlen)sizeof(integer));
00435 do_fio(&c__1, (char *)&result[0], (ftnlen)sizeof(real));
00436 e_wsfe();
00437 ++nfail;
00438 }
00439 ++nrun;
00440
00441
00442
00443
00444
00445 anorm = slanst_("1", &n, &d__[1], &e[1]);
00446
00447
00448
00449
00450 ainvnm = 0.f;
00451 i__3 = n;
00452 for (i__ = 1; i__ <= i__3; ++i__) {
00453 i__4 = n;
00454 for (j = 1; j <= i__4; ++j) {
00455 x[j] = 0.f;
00456
00457 }
00458 x[i__] = 1.f;
00459 spttrs_(&n, &c__1, &d__[n + 1], &e[n + 1], &x[1], &lda, &info)
00460 ;
00461
00462 r__1 = ainvnm, r__2 = sasum_(&n, &x[1], &c__1);
00463 ainvnm = dmax(r__1,r__2);
00464
00465 }
00466
00467 r__1 = 1.f, r__2 = anorm * ainvnm;
00468 rcondc = 1.f / dmax(r__1,r__2);
00469
00470 i__3 = *nns;
00471 for (irhs = 1; irhs <= i__3; ++irhs) {
00472 nrhs = nsval[irhs];
00473
00474
00475
00476 ix = 1;
00477 i__4 = nrhs;
00478 for (j = 1; j <= i__4; ++j) {
00479 slarnv_(&c__2, iseed, &n, &xact[ix]);
00480 ix += lda;
00481
00482 }
00483
00484
00485
00486 slaptm_(&n, &nrhs, &c_b46, &d__[1], &e[1], &xact[1], &lda, &
00487 c_b47, &b[1], &lda);
00488
00489
00490
00491
00492 slacpy_("Full", &n, &nrhs, &b[1], &lda, &x[1], &lda);
00493 spttrs_(&n, &nrhs, &d__[n + 1], &e[n + 1], &x[1], &lda, &info)
00494 ;
00495
00496
00497
00498 if (info != 0) {
00499 alaerh_(path, "SPTTRS", &info, &c__0, " ", &n, &n, &c_n1,
00500 &c_n1, &nrhs, &imat, &nfail, &nerrs, nout);
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[1], &
00505 lda, &result[1]);
00506
00507
00508
00509
00510 sget04_(&n, &nrhs, &x[1], &lda, &xact[1], &lda, &rcondc, &
00511 result[2]);
00512
00513
00514
00515
00516 s_copy(srnamc_1.srnamt, "SPTRFS", (ftnlen)32, (ftnlen)6);
00517 sptrfs_(&n, &nrhs, &d__[1], &e[1], &d__[n + 1], &e[n + 1], &b[
00518 1], &lda, &x[1], &lda, &rwork[1], &rwork[nrhs + 1], &
00519 work[1], &info);
00520
00521
00522
00523 if (info != 0) {
00524 alaerh_(path, "SPTRFS", &info, &c__0, " ", &n, &n, &c_n1,
00525 &c_n1, &nrhs, &imat, &nfail, &nerrs, nout);
00526 }
00527
00528 sget04_(&n, &nrhs, &x[1], &lda, &xact[1], &lda, &rcondc, &
00529 result[3]);
00530 sptt05_(&n, &nrhs, &d__[1], &e[1], &b[1], &lda, &x[1], &lda, &
00531 xact[1], &lda, &rwork[1], &rwork[nrhs + 1], &result[4]
00532 );
00533
00534
00535
00536
00537 for (k = 2; k <= 6; ++k) {
00538 if (result[k - 1] >= *thresh) {
00539 if (nfail == 0 && nerrs == 0) {
00540 alahd_(nout, path);
00541 }
00542 io___35.ciunit = *nout;
00543 s_wsfe(&io___35);
00544 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00545 do_fio(&c__1, (char *)&nrhs, (ftnlen)sizeof(integer));
00546 do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(integer));
00547 do_fio(&c__1, (char *)&k, (ftnlen)sizeof(integer));
00548 do_fio(&c__1, (char *)&result[k - 1], (ftnlen)sizeof(
00549 real));
00550 e_wsfe();
00551 ++nfail;
00552 }
00553
00554 }
00555 nrun += 5;
00556
00557 }
00558
00559
00560
00561
00562
00563 L90:
00564 s_copy(srnamc_1.srnamt, "SPTCON", (ftnlen)32, (ftnlen)6);
00565 sptcon_(&n, &d__[n + 1], &e[n + 1], &anorm, &rcond, &rwork[1], &
00566 info);
00567
00568
00569
00570 if (info != 0) {
00571 alaerh_(path, "SPTCON", &info, &c__0, " ", &n, &n, &c_n1, &
00572 c_n1, &c_n1, &imat, &nfail, &nerrs, nout);
00573 }
00574
00575 result[6] = sget06_(&rcond, &rcondc);
00576
00577
00578
00579 if (result[6] >= *thresh) {
00580 if (nfail == 0 && nerrs == 0) {
00581 alahd_(nout, path);
00582 }
00583 io___37.ciunit = *nout;
00584 s_wsfe(&io___37);
00585 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00586 do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(integer));
00587 do_fio(&c__1, (char *)&c__7, (ftnlen)sizeof(integer));
00588 do_fio(&c__1, (char *)&result[6], (ftnlen)sizeof(real));
00589 e_wsfe();
00590 ++nfail;
00591 }
00592 ++nrun;
00593 L100:
00594 ;
00595 }
00596
00597 }
00598
00599
00600
00601 alasum_(path, nout, &nfail, &nrun, &nerrs);
00602
00603 return 0;
00604
00605
00606
00607 }