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