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