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