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