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