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__0 = 0;
00034 static integer c_n1 = -1;
00035 static integer c__1 = 1;
00036 static real c_b60 = 0.f;
00037 static integer c__2 = 2;
00038
00039 int sdrvpp_(logical *dotype, integer *nn, integer *nval,
00040 integer *nrhs, real *thresh, logical *tsterr, integer *nmax, real *a,
00041 real *afac, real *asav, real *b, real *bsav, real *x, real *xact,
00042 real *s, real *work, real *rwork, integer *iwork, integer *nout)
00043 {
00044
00045
00046 static integer iseedy[4] = { 1988,1989,1990,1991 };
00047 static char uplos[1*2] = "U" "L";
00048 static char facts[1*3] = "F" "N" "E";
00049 static char packs[1*2] = "C" "R";
00050 static char equeds[1*2] = "N" "Y";
00051
00052
00053 static char fmt_9999[] = "(1x,a,\002, UPLO='\002,a1,\002', N =\002,i5"
00054 ",\002, type \002,i1,\002, test(\002,i1,\002)=\002,g12.5)";
00055 static char fmt_9997[] = "(1x,a,\002, FACT='\002,a1,\002', UPLO='\002,"
00056 "a1,\002', N=\002,i5,\002, EQUED='\002,a1,\002', type \002,i1,"
00057 "\002, test(\002,i1,\002)=\002,g12.5)";
00058 static char fmt_9998[] = "(1x,a,\002, FACT='\002,a1,\002', UPLO='\002,"
00059 "a1,\002', N=\002,i5,\002, type \002,i1,\002, test(\002,i1,\002)"
00060 "=\002,g12.5)";
00061
00062
00063 address a__1[2];
00064 integer i__1, i__2, i__3, i__4, i__5[2];
00065 char ch__1[2];
00066
00067
00068 int s_copy(char *, char *, ftnlen, ftnlen);
00069 integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
00070 int s_cat(char *, char **, integer *, integer *, ftnlen);
00071
00072
00073 integer i__, k, n, k1, in, kl, ku, nt, lda, npp;
00074 char fact[1];
00075 integer ioff, mode;
00076 real amax;
00077 char path[3];
00078 integer imat, info;
00079 char dist[1], uplo[1], type__[1];
00080 integer nrun, ifact, nfail, iseed[4], nfact;
00081 extern logical lsame_(char *, char *);
00082 char equed[1];
00083 real roldc, rcond, scond;
00084 extern int sget04_(integer *, integer *, real *, integer
00085 *, real *, integer *, real *, real *);
00086 integer nimat;
00087 extern doublereal sget06_(real *, real *);
00088 real anorm;
00089 logical equil;
00090 extern int sppt01_(char *, integer *, real *, real *,
00091 real *, real *);
00092 integer iuplo, izero, nerrs;
00093 extern int sppt02_(char *, integer *, integer *, real *,
00094 real *, integer *, real *, integer *, real *, real *),
00095 scopy_(integer *, real *, integer *, real *, integer *), sppt05_(
00096 char *, integer *, integer *, real *, real *, integer *, real *,
00097 integer *, real *, integer *, real *, real *, real *);
00098 logical zerot;
00099 char xtype[1];
00100 extern int sppsv_(char *, integer *, integer *, real *,
00101 real *, integer *, integer *), slatb4_(char *, integer *,
00102 integer *, integer *, char *, integer *, integer *, real *,
00103 integer *, real *, char *), aladhd_(
00104 integer *, char *), alaerh_(char *, char *, integer *,
00105 integer *, char *, integer *, integer *, integer *, integer *,
00106 integer *, integer *, integer *, integer *, integer *);
00107 logical prefac;
00108 real rcondc;
00109 logical nofact;
00110 char packit[1];
00111 integer iequed;
00112 extern int alasvm_(char *, integer *, integer *, integer
00113 *, integer *);
00114 real cndnum, ainvnm;
00115 extern int slacpy_(char *, integer *, integer *, real *,
00116 integer *, real *, integer *), slarhs_(char *, char *,
00117 char *, char *, integer *, integer *, integer *, integer *,
00118 integer *, real *, integer *, real *, integer *, real *, integer *
00119 , integer *, integer *), slaset_(
00120 char *, integer *, integer *, real *, real *, real *, integer *);
00121 extern doublereal slansp_(char *, char *, integer *, real *, real *);
00122 extern int slaqsp_(char *, integer *, real *, real *,
00123 real *, real *, char *), slatms_(integer *,
00124 integer *, char *, integer *, char *, real *, integer *, real *,
00125 real *, integer *, integer *, char *, real *, integer *, real *,
00126 integer *), sppequ_(char *, integer *,
00127 real *, real *, real *, real *, integer *);
00128 real result[6];
00129 extern int spptrf_(char *, integer *, real *, integer *), spptri_(char *, integer *, real *, integer *),
00130 serrvx_(char *, integer *), sppsvx_(char *, char *,
00131 integer *, integer *, real *, real *, char *, real *, real *,
00132 integer *, real *, integer *, real *, real *, real *, real *,
00133 integer *, integer *);
00134
00135
00136 static cilist io___49 = { 0, 0, 0, fmt_9999, 0 };
00137 static cilist io___52 = { 0, 0, 0, fmt_9997, 0 };
00138 static cilist io___53 = { 0, 0, 0, fmt_9998, 0 };
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
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235 --iwork;
00236 --rwork;
00237 --work;
00238 --s;
00239 --xact;
00240 --x;
00241 --bsav;
00242 --b;
00243 --asav;
00244 --afac;
00245 --a;
00246 --nval;
00247 --dotype;
00248
00249
00250
00251
00252
00253
00254
00255 s_copy(path, "Single precision", (ftnlen)1, (ftnlen)16);
00256 s_copy(path + 1, "PP", (ftnlen)2, (ftnlen)2);
00257 nrun = 0;
00258 nfail = 0;
00259 nerrs = 0;
00260 for (i__ = 1; i__ <= 4; ++i__) {
00261 iseed[i__ - 1] = iseedy[i__ - 1];
00262
00263 }
00264
00265
00266
00267 if (*tsterr) {
00268 serrvx_(path, nout);
00269 }
00270 infoc_1.infot = 0;
00271
00272
00273
00274 i__1 = *nn;
00275 for (in = 1; in <= i__1; ++in) {
00276 n = nval[in];
00277 lda = max(n,1);
00278 npp = n * (n + 1) / 2;
00279 *(unsigned char *)xtype = 'N';
00280 nimat = 9;
00281 if (n <= 0) {
00282 nimat = 1;
00283 }
00284
00285 i__2 = nimat;
00286 for (imat = 1; imat <= i__2; ++imat) {
00287
00288
00289
00290 if (! dotype[imat]) {
00291 goto L130;
00292 }
00293
00294
00295
00296 zerot = imat >= 3 && imat <= 5;
00297 if (zerot && n < imat - 2) {
00298 goto L130;
00299 }
00300
00301
00302
00303 for (iuplo = 1; iuplo <= 2; ++iuplo) {
00304 *(unsigned char *)uplo = *(unsigned char *)&uplos[iuplo - 1];
00305 *(unsigned char *)packit = *(unsigned char *)&packs[iuplo - 1]
00306 ;
00307
00308
00309
00310
00311 slatb4_(path, &imat, &n, &n, type__, &kl, &ku, &anorm, &mode,
00312 &cndnum, dist);
00313 rcondc = 1.f / cndnum;
00314
00315 s_copy(srnamc_1.srnamt, "SLATMS", (ftnlen)32, (ftnlen)6);
00316 slatms_(&n, &n, dist, iseed, type__, &rwork[1], &mode, &
00317 cndnum, &anorm, &kl, &ku, packit, &a[1], &lda, &work[
00318 1], &info);
00319
00320
00321
00322 if (info != 0) {
00323 alaerh_(path, "SLATMS", &info, &c__0, uplo, &n, &n, &c_n1,
00324 &c_n1, &c_n1, &imat, &nfail, &nerrs, nout);
00325 goto L120;
00326 }
00327
00328
00329
00330
00331 if (zerot) {
00332 if (imat == 3) {
00333 izero = 1;
00334 } else if (imat == 4) {
00335 izero = n;
00336 } else {
00337 izero = n / 2 + 1;
00338 }
00339
00340
00341
00342 if (iuplo == 1) {
00343 ioff = (izero - 1) * izero / 2;
00344 i__3 = izero - 1;
00345 for (i__ = 1; i__ <= i__3; ++i__) {
00346 a[ioff + i__] = 0.f;
00347
00348 }
00349 ioff += izero;
00350 i__3 = n;
00351 for (i__ = izero; i__ <= i__3; ++i__) {
00352 a[ioff] = 0.f;
00353 ioff += i__;
00354
00355 }
00356 } else {
00357 ioff = izero;
00358 i__3 = izero - 1;
00359 for (i__ = 1; i__ <= i__3; ++i__) {
00360 a[ioff] = 0.f;
00361 ioff = ioff + n - i__;
00362
00363 }
00364 ioff -= izero;
00365 i__3 = n;
00366 for (i__ = izero; i__ <= i__3; ++i__) {
00367 a[ioff + i__] = 0.f;
00368
00369 }
00370 }
00371 } else {
00372 izero = 0;
00373 }
00374
00375
00376
00377 scopy_(&npp, &a[1], &c__1, &asav[1], &c__1);
00378
00379 for (iequed = 1; iequed <= 2; ++iequed) {
00380 *(unsigned char *)equed = *(unsigned char *)&equeds[
00381 iequed - 1];
00382 if (iequed == 1) {
00383 nfact = 3;
00384 } else {
00385 nfact = 1;
00386 }
00387
00388 i__3 = nfact;
00389 for (ifact = 1; ifact <= i__3; ++ifact) {
00390 *(unsigned char *)fact = *(unsigned char *)&facts[
00391 ifact - 1];
00392 prefac = lsame_(fact, "F");
00393 nofact = lsame_(fact, "N");
00394 equil = lsame_(fact, "E");
00395
00396 if (zerot) {
00397 if (prefac) {
00398 goto L100;
00399 }
00400 rcondc = 0.f;
00401
00402 } else if (! lsame_(fact, "N"))
00403 {
00404
00405
00406
00407
00408
00409
00410 scopy_(&npp, &asav[1], &c__1, &afac[1], &c__1);
00411 if (equil || iequed > 1) {
00412
00413
00414
00415
00416 sppequ_(uplo, &n, &afac[1], &s[1], &scond, &
00417 amax, &info);
00418 if (info == 0 && n > 0) {
00419 if (iequed > 1) {
00420 scond = 0.f;
00421 }
00422
00423
00424
00425 slaqsp_(uplo, &n, &afac[1], &s[1], &scond,
00426 &amax, equed);
00427 }
00428 }
00429
00430
00431
00432
00433 if (equil) {
00434 roldc = rcondc;
00435 }
00436
00437
00438
00439 anorm = slansp_("1", uplo, &n, &afac[1], &rwork[1]
00440 );
00441
00442
00443
00444 spptrf_(uplo, &n, &afac[1], &info);
00445
00446
00447
00448 scopy_(&npp, &afac[1], &c__1, &a[1], &c__1);
00449 spptri_(uplo, &n, &a[1], &info);
00450
00451
00452
00453 ainvnm = slansp_("1", uplo, &n, &a[1], &rwork[1]);
00454 if (anorm <= 0.f || ainvnm <= 0.f) {
00455 rcondc = 1.f;
00456 } else {
00457 rcondc = 1.f / anorm / ainvnm;
00458 }
00459 }
00460
00461
00462
00463 scopy_(&npp, &asav[1], &c__1, &a[1], &c__1);
00464
00465
00466
00467 s_copy(srnamc_1.srnamt, "SLARHS", (ftnlen)32, (ftnlen)
00468 6);
00469 slarhs_(path, xtype, uplo, " ", &n, &n, &kl, &ku,
00470 nrhs, &a[1], &lda, &xact[1], &lda, &b[1], &
00471 lda, iseed, &info);
00472 *(unsigned char *)xtype = 'C';
00473 slacpy_("Full", &n, nrhs, &b[1], &lda, &bsav[1], &lda);
00474
00475 if (nofact) {
00476
00477
00478
00479
00480
00481
00482 scopy_(&npp, &a[1], &c__1, &afac[1], &c__1);
00483 slacpy_("Full", &n, nrhs, &b[1], &lda, &x[1], &
00484 lda);
00485
00486 s_copy(srnamc_1.srnamt, "SPPSV ", (ftnlen)32, (
00487 ftnlen)6);
00488 sppsv_(uplo, &n, nrhs, &afac[1], &x[1], &lda, &
00489 info);
00490
00491
00492
00493 if (info != izero) {
00494 alaerh_(path, "SPPSV ", &info, &izero, uplo, &
00495 n, &n, &c_n1, &c_n1, nrhs, &imat, &
00496 nfail, &nerrs, nout);
00497 goto L70;
00498 } else if (info != 0) {
00499 goto L70;
00500 }
00501
00502
00503
00504
00505 sppt01_(uplo, &n, &a[1], &afac[1], &rwork[1],
00506 result);
00507
00508
00509
00510 slacpy_("Full", &n, nrhs, &b[1], &lda, &work[1], &
00511 lda);
00512 sppt02_(uplo, &n, nrhs, &a[1], &x[1], &lda, &work[
00513 1], &lda, &rwork[1], &result[1]);
00514
00515
00516
00517 sget04_(&n, nrhs, &x[1], &lda, &xact[1], &lda, &
00518 rcondc, &result[2]);
00519 nt = 3;
00520
00521
00522
00523
00524 i__4 = nt;
00525 for (k = 1; k <= i__4; ++k) {
00526 if (result[k - 1] >= *thresh) {
00527 if (nfail == 0 && nerrs == 0) {
00528 aladhd_(nout, path);
00529 }
00530 io___49.ciunit = *nout;
00531 s_wsfe(&io___49);
00532 do_fio(&c__1, "SPPSV ", (ftnlen)6);
00533 do_fio(&c__1, uplo, (ftnlen)1);
00534 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(
00535 integer));
00536 do_fio(&c__1, (char *)&imat, (ftnlen)
00537 sizeof(integer));
00538 do_fio(&c__1, (char *)&k, (ftnlen)sizeof(
00539 integer));
00540 do_fio(&c__1, (char *)&result[k - 1], (
00541 ftnlen)sizeof(real));
00542 e_wsfe();
00543 ++nfail;
00544 }
00545
00546 }
00547 nrun += nt;
00548 L70:
00549 ;
00550 }
00551
00552
00553
00554 if (! prefac && npp > 0) {
00555 slaset_("Full", &npp, &c__1, &c_b60, &c_b60, &
00556 afac[1], &npp);
00557 }
00558 slaset_("Full", &n, nrhs, &c_b60, &c_b60, &x[1], &lda);
00559 if (iequed > 1 && n > 0) {
00560
00561
00562
00563
00564 slaqsp_(uplo, &n, &a[1], &s[1], &scond, &amax,
00565 equed);
00566 }
00567
00568
00569
00570
00571 s_copy(srnamc_1.srnamt, "SPPSVX", (ftnlen)32, (ftnlen)
00572 6);
00573 sppsvx_(fact, uplo, &n, nrhs, &a[1], &afac[1], equed,
00574 &s[1], &b[1], &lda, &x[1], &lda, &rcond, &
00575 rwork[1], &rwork[*nrhs + 1], &work[1], &iwork[
00576 1], &info);
00577
00578
00579
00580 if (info != izero) {
00581
00582 i__5[0] = 1, a__1[0] = fact;
00583 i__5[1] = 1, a__1[1] = uplo;
00584 s_cat(ch__1, a__1, i__5, &c__2, (ftnlen)2);
00585 alaerh_(path, "SPPSVX", &info, &izero, ch__1, &n,
00586 &n, &c_n1, &c_n1, nrhs, &imat, &nfail, &
00587 nerrs, nout);
00588 goto L90;
00589 }
00590
00591 if (info == 0) {
00592 if (! prefac) {
00593
00594
00595
00596
00597 sppt01_(uplo, &n, &a[1], &afac[1], &rwork[(*
00598 nrhs << 1) + 1], result);
00599 k1 = 1;
00600 } else {
00601 k1 = 2;
00602 }
00603
00604
00605
00606 slacpy_("Full", &n, nrhs, &bsav[1], &lda, &work[1]
00607 , &lda);
00608 sppt02_(uplo, &n, nrhs, &asav[1], &x[1], &lda, &
00609 work[1], &lda, &rwork[(*nrhs << 1) + 1], &
00610 result[1]);
00611
00612
00613
00614 if (nofact || prefac && lsame_(equed, "N")) {
00615 sget04_(&n, nrhs, &x[1], &lda, &xact[1], &lda,
00616 &rcondc, &result[2]);
00617 } else {
00618 sget04_(&n, nrhs, &x[1], &lda, &xact[1], &lda,
00619 &roldc, &result[2]);
00620 }
00621
00622
00623
00624
00625 sppt05_(uplo, &n, nrhs, &asav[1], &b[1], &lda, &x[
00626 1], &lda, &xact[1], &lda, &rwork[1], &
00627 rwork[*nrhs + 1], &result[3]);
00628 } else {
00629 k1 = 6;
00630 }
00631
00632
00633
00634
00635 result[5] = sget06_(&rcond, &rcondc);
00636
00637
00638
00639
00640 for (k = k1; k <= 6; ++k) {
00641 if (result[k - 1] >= *thresh) {
00642 if (nfail == 0 && nerrs == 0) {
00643 aladhd_(nout, path);
00644 }
00645 if (prefac) {
00646 io___52.ciunit = *nout;
00647 s_wsfe(&io___52);
00648 do_fio(&c__1, "SPPSVX", (ftnlen)6);
00649 do_fio(&c__1, fact, (ftnlen)1);
00650 do_fio(&c__1, uplo, (ftnlen)1);
00651 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(
00652 integer));
00653 do_fio(&c__1, equed, (ftnlen)1);
00654 do_fio(&c__1, (char *)&imat, (ftnlen)
00655 sizeof(integer));
00656 do_fio(&c__1, (char *)&k, (ftnlen)sizeof(
00657 integer));
00658 do_fio(&c__1, (char *)&result[k - 1], (
00659 ftnlen)sizeof(real));
00660 e_wsfe();
00661 } else {
00662 io___53.ciunit = *nout;
00663 s_wsfe(&io___53);
00664 do_fio(&c__1, "SPPSVX", (ftnlen)6);
00665 do_fio(&c__1, fact, (ftnlen)1);
00666 do_fio(&c__1, uplo, (ftnlen)1);
00667 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(
00668 integer));
00669 do_fio(&c__1, (char *)&imat, (ftnlen)
00670 sizeof(integer));
00671 do_fio(&c__1, (char *)&k, (ftnlen)sizeof(
00672 integer));
00673 do_fio(&c__1, (char *)&result[k - 1], (
00674 ftnlen)sizeof(real));
00675 e_wsfe();
00676 }
00677 ++nfail;
00678 }
00679
00680 }
00681 nrun = nrun + 7 - k1;
00682 L90:
00683 L100:
00684 ;
00685 }
00686
00687 }
00688 L120:
00689 ;
00690 }
00691 L130:
00692 ;
00693 }
00694
00695 }
00696
00697
00698
00699 alasvm_(path, nout, &nfail, &nrun, &nerrs);
00700
00701 return 0;
00702
00703
00704
00705 }