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