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