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