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