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 real c_b49 = 0.f;
00038
00039 int sdrvsy_(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 uplos[1*2] = "U" "L";
00048 static char facts[1*2] = "F" "N";
00049
00050
00051 static char fmt_9999[] = "(1x,a,\002, UPLO='\002,a1,\002', N =\002,i5"
00052 ",\002, type \002,i2,\002, test \002,i2,\002, ratio =\002,g12.5)";
00053 static char fmt_9998[] = "(1x,a,\002, FACT='\002,a1,\002', UPLO='\002,"
00054 "a1,\002', N =\002,i5,\002, type \002,i2,\002, test \002,i2,\002,"
00055 " ratio =\002,g12.5)";
00056
00057
00058 address a__1[2];
00059 integer i__1, i__2, i__3, i__4, i__5[2];
00060 char ch__1[2];
00061
00062
00063 int s_copy(char *, char *, ftnlen, ftnlen);
00064 integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
00065 int s_cat(char *, char **, integer *, integer *, ftnlen);
00066
00067
00068 integer i__, j, k, n, i1, i2, k1, nb, in, kl, ku, nt, lda;
00069 char fact[1];
00070 integer ioff, mode, imat, info;
00071 char path[3], dist[1], uplo[1], type__[1];
00072 integer nrun, ifact, nfail, iseed[4], nbmin;
00073 real rcond;
00074 extern int sget04_(integer *, integer *, real *, integer
00075 *, real *, integer *, real *, real *);
00076 integer nimat;
00077 extern doublereal sget06_(real *, real *);
00078 real anorm;
00079 extern int spot02_(char *, integer *, integer *, real *,
00080 integer *, real *, integer *, real *, integer *, real *, real *);
00081 integer iuplo, izero, nerrs;
00082 extern int spot05_(char *, integer *, integer *, real *,
00083 integer *, real *, integer *, real *, integer *, real *, integer *
00084 , real *, real *, real *);
00085 integer lwork;
00086 logical zerot;
00087 extern int ssyt01_(char *, integer *, real *, integer *,
00088 real *, integer *, integer *, real *, integer *, real *, real *);
00089 char xtype[1];
00090 extern int ssysv_(char *, integer *, integer *, real *,
00091 integer *, integer *, real *, integer *, real *, integer *,
00092 integer *), slatb4_(char *, integer *, integer *, integer
00093 *, char *, integer *, integer *, real *, integer *, real *, char *
00094 ), aladhd_(integer *, char *),
00095 alaerh_(char *, char *, integer *, integer *, char *, integer *,
00096 integer *, integer *, integer *, integer *, integer *, integer *,
00097 integer *, integer *);
00098 real rcondc;
00099 extern int alasvm_(char *, integer *, integer *, integer
00100 *, integer *);
00101 real cndnum, ainvnm;
00102 extern int slacpy_(char *, integer *, integer *, real *,
00103 integer *, real *, integer *), slarhs_(char *, char *,
00104 char *, char *, integer *, integer *, integer *, integer *,
00105 integer *, real *, integer *, real *, integer *, real *, integer *
00106 , integer *, integer *), slaset_(
00107 char *, integer *, integer *, real *, real *, real *, integer *), xlaenv_(integer *, integer *), slatms_(integer *,
00108 integer *, char *, integer *, char *, real *, integer *, real *,
00109 real *, integer *, integer *, char *, real *, integer *, real *,
00110 integer *);
00111 extern doublereal slansy_(char *, char *, integer *, real *, integer *,
00112 real *);
00113 real result[6];
00114 extern int serrvx_(char *, integer *), ssytrf_(
00115 char *, integer *, real *, integer *, integer *, real *, integer *
00116 , integer *), ssytri_(char *, integer *, real *, integer *
00117 , integer *, real *, integer *), ssysvx_(char *, char *,
00118 integer *, integer *, real *, integer *, real *, integer *,
00119 integer *, real *, integer *, real *, integer *, real *, real *,
00120 real *, real *, integer *, integer *, integer *);
00121
00122
00123 static cilist io___42 = { 0, 0, 0, fmt_9999, 0 };
00124 static cilist io___45 = { 0, 0, 0, fmt_9998, 0 };
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, "SY", (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 nb = 1;
00255 nbmin = 2;
00256 xlaenv_(&c__1, &nb);
00257 xlaenv_(&c__2, &nbmin);
00258
00259
00260
00261 i__1 = *nn;
00262 for (in = 1; in <= i__1; ++in) {
00263 n = nval[in];
00264 lda = max(n,1);
00265 *(unsigned char *)xtype = 'N';
00266 nimat = 10;
00267 if (n <= 0) {
00268 nimat = 1;
00269 }
00270
00271 i__2 = nimat;
00272 for (imat = 1; imat <= i__2; ++imat) {
00273
00274
00275
00276 if (! dotype[imat]) {
00277 goto L170;
00278 }
00279
00280
00281
00282 zerot = imat >= 3 && imat <= 6;
00283 if (zerot && n < imat - 2) {
00284 goto L170;
00285 }
00286
00287
00288
00289 for (iuplo = 1; iuplo <= 2; ++iuplo) {
00290 *(unsigned char *)uplo = *(unsigned char *)&uplos[iuplo - 1];
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, uplo, &a[1], &lda, &work[1],
00301 &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) * lda;
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 += lda;
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 += lda;
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 += lda;
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 += lda;
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 = slansy_("1", uplo, &n, &a[1], &lda, &rwork[1]);
00415
00416
00417
00418 slacpy_(uplo, &n, &n, &a[1], &lda, &afac[1], &lda);
00419 ssytrf_(uplo, &n, &afac[1], &lda, &iwork[1], &work[1],
00420 &lwork, &info);
00421
00422
00423
00424 slacpy_(uplo, &n, &n, &afac[1], &lda, &ainv[1], &lda);
00425 ssytri_(uplo, &n, &ainv[1], &lda, &iwork[1], &work[1],
00426 &info);
00427 ainvnm = slansy_("1", uplo, &n, &ainv[1], &lda, &
00428 rwork[1]);
00429
00430
00431
00432 if (anorm <= 0.f || ainvnm <= 0.f) {
00433 rcondc = 1.f;
00434 } else {
00435 rcondc = 1.f / anorm / ainvnm;
00436 }
00437 }
00438
00439
00440
00441 s_copy(srnamc_1.srnamt, "SLARHS", (ftnlen)32, (ftnlen)6);
00442 slarhs_(path, xtype, uplo, " ", &n, &n, &kl, &ku, nrhs, &
00443 a[1], &lda, &xact[1], &lda, &b[1], &lda, iseed, &
00444 info);
00445 *(unsigned char *)xtype = 'C';
00446
00447
00448
00449 if (ifact == 2) {
00450 slacpy_(uplo, &n, &n, &a[1], &lda, &afac[1], &lda);
00451 slacpy_("Full", &n, nrhs, &b[1], &lda, &x[1], &lda);
00452
00453
00454
00455 s_copy(srnamc_1.srnamt, "SSYSV ", (ftnlen)32, (ftnlen)
00456 6);
00457 ssysv_(uplo, &n, nrhs, &afac[1], &lda, &iwork[1], &x[
00458 1], &lda, &work[1], &lwork, &info);
00459
00460
00461
00462
00463 k = izero;
00464 if (k > 0) {
00465 L100:
00466 if (iwork[k] < 0) {
00467 if (iwork[k] != -k) {
00468 k = -iwork[k];
00469 goto L100;
00470 }
00471 } else if (iwork[k] != k) {
00472 k = iwork[k];
00473 goto L100;
00474 }
00475 }
00476
00477
00478
00479 if (info != k) {
00480 alaerh_(path, "SSYSV ", &info, &k, uplo, &n, &n, &
00481 c_n1, &c_n1, nrhs, &imat, &nfail, &nerrs,
00482 nout);
00483 goto L120;
00484 } else if (info != 0) {
00485 goto L120;
00486 }
00487
00488
00489
00490
00491 ssyt01_(uplo, &n, &a[1], &lda, &afac[1], &lda, &iwork[
00492 1], &ainv[1], &lda, &rwork[1], result);
00493
00494
00495
00496 slacpy_("Full", &n, nrhs, &b[1], &lda, &work[1], &lda);
00497 spot02_(uplo, &n, nrhs, &a[1], &lda, &x[1], &lda, &
00498 work[1], &lda, &rwork[1], &result[1]);
00499
00500
00501
00502 sget04_(&n, nrhs, &x[1], &lda, &xact[1], &lda, &
00503 rcondc, &result[2]);
00504 nt = 3;
00505
00506
00507
00508
00509 i__3 = nt;
00510 for (k = 1; k <= i__3; ++k) {
00511 if (result[k - 1] >= *thresh) {
00512 if (nfail == 0 && nerrs == 0) {
00513 aladhd_(nout, path);
00514 }
00515 io___42.ciunit = *nout;
00516 s_wsfe(&io___42);
00517 do_fio(&c__1, "SSYSV ", (ftnlen)6);
00518 do_fio(&c__1, uplo, (ftnlen)1);
00519 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(
00520 integer));
00521 do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(
00522 integer));
00523 do_fio(&c__1, (char *)&k, (ftnlen)sizeof(
00524 integer));
00525 do_fio(&c__1, (char *)&result[k - 1], (ftnlen)
00526 sizeof(real));
00527 e_wsfe();
00528 ++nfail;
00529 }
00530
00531 }
00532 nrun += nt;
00533 L120:
00534 ;
00535 }
00536
00537
00538
00539 if (ifact == 2) {
00540 slaset_(uplo, &n, &n, &c_b49, &c_b49, &afac[1], &lda);
00541 }
00542 slaset_("Full", &n, nrhs, &c_b49, &c_b49, &x[1], &lda);
00543
00544
00545
00546
00547 s_copy(srnamc_1.srnamt, "SSYSVX", (ftnlen)32, (ftnlen)6);
00548 ssysvx_(fact, uplo, &n, nrhs, &a[1], &lda, &afac[1], &lda,
00549 &iwork[1], &b[1], &lda, &x[1], &lda, &rcond, &
00550 rwork[1], &rwork[*nrhs + 1], &work[1], &lwork, &
00551 iwork[n + 1], &info);
00552
00553
00554
00555
00556 k = izero;
00557 if (k > 0) {
00558 L130:
00559 if (iwork[k] < 0) {
00560 if (iwork[k] != -k) {
00561 k = -iwork[k];
00562 goto L130;
00563 }
00564 } else if (iwork[k] != k) {
00565 k = iwork[k];
00566 goto L130;
00567 }
00568 }
00569
00570
00571
00572 if (info != k) {
00573
00574 i__5[0] = 1, a__1[0] = fact;
00575 i__5[1] = 1, a__1[1] = uplo;
00576 s_cat(ch__1, a__1, i__5, &c__2, (ftnlen)2);
00577 alaerh_(path, "SSYSVX", &info, &k, ch__1, &n, &n, &
00578 c_n1, &c_n1, nrhs, &imat, &nfail, &nerrs,
00579 nout);
00580 goto L150;
00581 }
00582
00583 if (info == 0) {
00584 if (ifact >= 2) {
00585
00586
00587
00588
00589 ssyt01_(uplo, &n, &a[1], &lda, &afac[1], &lda, &
00590 iwork[1], &ainv[1], &lda, &rwork[(*nrhs <<
00591 1) + 1], result);
00592 k1 = 1;
00593 } else {
00594 k1 = 2;
00595 }
00596
00597
00598
00599 slacpy_("Full", &n, nrhs, &b[1], &lda, &work[1], &lda);
00600 spot02_(uplo, &n, nrhs, &a[1], &lda, &x[1], &lda, &
00601 work[1], &lda, &rwork[(*nrhs << 1) + 1], &
00602 result[1]);
00603
00604
00605
00606 sget04_(&n, nrhs, &x[1], &lda, &xact[1], &lda, &
00607 rcondc, &result[2]);
00608
00609
00610
00611 spot05_(uplo, &n, nrhs, &a[1], &lda, &b[1], &lda, &x[
00612 1], &lda, &xact[1], &lda, &rwork[1], &rwork[*
00613 nrhs + 1], &result[3]);
00614 } else {
00615 k1 = 6;
00616 }
00617
00618
00619
00620
00621 result[5] = sget06_(&rcond, &rcondc);
00622
00623
00624
00625
00626 for (k = k1; k <= 6; ++k) {
00627 if (result[k - 1] >= *thresh) {
00628 if (nfail == 0 && nerrs == 0) {
00629 aladhd_(nout, path);
00630 }
00631 io___45.ciunit = *nout;
00632 s_wsfe(&io___45);
00633 do_fio(&c__1, "SSYSVX", (ftnlen)6);
00634 do_fio(&c__1, fact, (ftnlen)1);
00635 do_fio(&c__1, uplo, (ftnlen)1);
00636 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer))
00637 ;
00638 do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(
00639 integer));
00640 do_fio(&c__1, (char *)&k, (ftnlen)sizeof(integer))
00641 ;
00642 do_fio(&c__1, (char *)&result[k - 1], (ftnlen)
00643 sizeof(real));
00644 e_wsfe();
00645 ++nfail;
00646 }
00647
00648 }
00649 nrun = nrun + 7 - k1;
00650
00651 L150:
00652 ;
00653 }
00654
00655 L160:
00656 ;
00657 }
00658 L170:
00659 ;
00660 }
00661
00662 }
00663
00664
00665
00666 alasvm_(path, nout, &nfail, &nrun, &nerrs);
00667
00668 return 0;
00669
00670
00671
00672 }