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