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