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