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