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