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 complex c_b64 = {0.f,0.f};
00038
00039 int cdrvhp_(logical *dotype, integer *nn, integer *nval,
00040 integer *nrhs, real *thresh, logical *tsterr, integer *nmax, complex *
00041 a, complex *afac, complex *ainv, complex *b, complex *x, complex *
00042 xact, complex *work, real *rwork, integer *iwork, integer *nout)
00043 {
00044
00045
00046 static integer iseedy[4] = { 1988,1989,1990,1991 };
00047 static char facts[1*2] = "F" "N";
00048
00049
00050 static char fmt_9999[] = "(1x,a,\002, UPLO='\002,a1,\002', N =\002,i5"
00051 ",\002, type \002,i2,\002, test \002,i2,\002, ratio =\002,g12.5)";
00052 static char fmt_9998[] = "(1x,a,\002, FACT='\002,a1,\002', UPLO='\002,"
00053 "a1,\002', N =\002,i5,\002, type \002,i2,\002, test \002,i2,\002,"
00054 " ratio =\002,g12.5)";
00055
00056
00057 address a__1[2];
00058 integer i__1, i__2, i__3, i__4, i__5, i__6[2];
00059 char ch__1[2];
00060
00061
00062 int s_copy(char *, char *, ftnlen, ftnlen);
00063 integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
00064 int s_cat(char *, char **, integer *, integer *, ftnlen);
00065
00066
00067 integer i__, j, k, n, i1, i2, k1, nb, in, kl, ku, nt, lda, npp;
00068 char fact[1];
00069 integer ioff, mode, imat, info;
00070 char path[3], dist[1], uplo[1], type__[1];
00071 integer nrun, ifact;
00072 extern int cget04_(integer *, integer *, complex *,
00073 integer *, complex *, integer *, real *, real *);
00074 integer nfail, iseed[4];
00075 extern int chpt01_(char *, integer *, complex *, complex
00076 *, integer *, complex *, integer *, real *, real *);
00077 integer nbmin;
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 *), cppt05_(char *, integer *, integer *, complex *, complex
00083 *, integer *, complex *, integer *, complex *, integer *, real *,
00084 real *, real *);
00085 real anorm;
00086 extern int ccopy_(integer *, complex *, integer *,
00087 complex *, integer *), chpsv_(char *, integer *, integer *,
00088 complex *, integer *, complex *, integer *, integer *);
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 ), aladhd_(integer *, char *),
00095 alaerh_(char *, char *, integer *, integer *, char *, integer *,
00096 integer *, integer *, integer *, integer *, integer *, integer *,
00097 integer *, integer *), claipd_(integer *,
00098 complex *, integer *, integer *);
00099 extern doublereal clanhp_(char *, char *, integer *, complex *, real *);
00100 real rcondc;
00101 char packit[1];
00102 extern int clacpy_(char *, integer *, integer *, complex
00103 *, integer *, complex *, integer *), clarhs_(char *, char
00104 *, char *, char *, integer *, integer *, integer *, integer *,
00105 integer *, complex *, integer *, complex *, integer *, complex *,
00106 integer *, integer *, integer *),
00107 claset_(char *, integer *, integer *, complex *, complex *,
00108 complex *, integer *), alasvm_(char *, integer *, integer
00109 *, integer *, integer *);
00110 real cndnum;
00111 extern int clatms_(integer *, integer *, char *, integer
00112 *, char *, real *, integer *, real *, real *, integer *, integer *
00113 , char *, complex *, integer *, complex *, integer *), chptrf_(char *, integer *, complex *, integer *,
00114 integer *);
00115 real ainvnm;
00116 extern int chptri_(char *, integer *, complex *, integer
00117 *, complex *, integer *), xlaenv_(integer *, integer *),
00118 cerrvx_(char *, integer *), chpsvx_(char *, char *,
00119 integer *, integer *, complex *, complex *, integer *, complex *,
00120 integer *, complex *, integer *, real *, real *, real *, complex *
00121 , real *, integer *);
00122 real result[6];
00123
00124
00125 static cilist io___42 = { 0, 0, 0, fmt_9999, 0 };
00126 static cilist io___45 = { 0, 0, 0, fmt_9998, 0 };
00127
00128
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 --iwork;
00220 --rwork;
00221 --work;
00222 --xact;
00223 --x;
00224 --b;
00225 --ainv;
00226 --afac;
00227 --a;
00228 --nval;
00229 --dotype;
00230
00231
00232
00233
00234
00235
00236
00237 *(unsigned char *)path = 'C';
00238 s_copy(path + 1, "HP", (ftnlen)2, (ftnlen)2);
00239 nrun = 0;
00240 nfail = 0;
00241 nerrs = 0;
00242 for (i__ = 1; i__ <= 4; ++i__) {
00243 iseed[i__ - 1] = iseedy[i__ - 1];
00244
00245 }
00246
00247
00248
00249 if (*tsterr) {
00250 cerrvx_(path, nout);
00251 }
00252 infoc_1.infot = 0;
00253
00254
00255
00256 nb = 1;
00257 nbmin = 2;
00258 xlaenv_(&c__1, &nb);
00259 xlaenv_(&c__2, &nbmin);
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 npp = n * (n + 1) / 2;
00268 *(unsigned char *)xtype = 'N';
00269 nimat = 10;
00270 if (n <= 0) {
00271 nimat = 1;
00272 }
00273
00274 i__2 = nimat;
00275 for (imat = 1; imat <= i__2; ++imat) {
00276
00277
00278
00279 if (! dotype[imat]) {
00280 goto L170;
00281 }
00282
00283
00284
00285 zerot = imat >= 3 && imat <= 6;
00286 if (zerot && n < imat - 2) {
00287 goto L170;
00288 }
00289
00290
00291
00292 for (iuplo = 1; iuplo <= 2; ++iuplo) {
00293 if (iuplo == 1) {
00294 *(unsigned char *)uplo = 'U';
00295 *(unsigned char *)packit = 'C';
00296 } else {
00297 *(unsigned char *)uplo = 'L';
00298 *(unsigned char *)packit = 'R';
00299 }
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, packit, &a[1], &lda, &work[
00310 1], &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) * izero / 2;
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 += i__;
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 = ioff + n - i__;
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 += j;
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 = ioff + n - j;
00401
00402 }
00403 }
00404 }
00405 } else {
00406 izero = 0;
00407 }
00408
00409
00410
00411 if (iuplo == 1) {
00412 claipd_(&n, &a[1], &c__2, &c__1);
00413 } else {
00414 claipd_(&n, &a[1], &n, &c_n1);
00415 }
00416
00417 for (ifact = 1; ifact <= 2; ++ifact) {
00418
00419
00420
00421 *(unsigned char *)fact = *(unsigned char *)&facts[ifact -
00422 1];
00423
00424
00425
00426
00427 if (zerot) {
00428 if (ifact == 1) {
00429 goto L150;
00430 }
00431 rcondc = 0.f;
00432
00433 } else if (ifact == 1) {
00434
00435
00436
00437 anorm = clanhp_("1", uplo, &n, &a[1], &rwork[1]);
00438
00439
00440
00441 ccopy_(&npp, &a[1], &c__1, &afac[1], &c__1);
00442 chptrf_(uplo, &n, &afac[1], &iwork[1], &info);
00443
00444
00445
00446 ccopy_(&npp, &afac[1], &c__1, &ainv[1], &c__1);
00447 chptri_(uplo, &n, &ainv[1], &iwork[1], &work[1], &
00448 info);
00449 ainvnm = clanhp_("1", uplo, &n, &ainv[1], &rwork[1]);
00450
00451
00452
00453 if (anorm <= 0.f || ainvnm <= 0.f) {
00454 rcondc = 1.f;
00455 } else {
00456 rcondc = 1.f / anorm / ainvnm;
00457 }
00458 }
00459
00460
00461
00462 s_copy(srnamc_1.srnamt, "CLARHS", (ftnlen)32, (ftnlen)6);
00463 clarhs_(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 ccopy_(&npp, &a[1], &c__1, &afac[1], &c__1);
00472 clacpy_("Full", &n, nrhs, &b[1], &lda, &x[1], &lda);
00473
00474
00475
00476 s_copy(srnamc_1.srnamt, "CHPSV ", (ftnlen)32, (ftnlen)
00477 6);
00478 chpsv_(uplo, &n, nrhs, &afac[1], &iwork[1], &x[1], &
00479 lda, &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, "CHPSV ", &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 chpt01_(uplo, &n, &a[1], &afac[1], &iwork[1], &ainv[1]
00513 , &lda, &rwork[1], result);
00514
00515
00516
00517 clacpy_("Full", &n, nrhs, &b[1], &lda, &work[1], &lda);
00518 cppt02_(uplo, &n, nrhs, &a[1], &x[1], &lda, &work[1],
00519 &lda, &rwork[1], &result[1]);
00520
00521
00522
00523 cget04_(&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, "CHPSV ", (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(real));
00548 e_wsfe();
00549 ++nfail;
00550 }
00551
00552 }
00553 nrun += nt;
00554 L120:
00555 ;
00556 }
00557
00558
00559
00560 if (ifact == 2 && npp > 0) {
00561 claset_("Full", &npp, &c__1, &c_b64, &c_b64, &afac[1],
00562 &npp);
00563 }
00564 claset_("Full", &n, nrhs, &c_b64, &c_b64, &x[1], &lda);
00565
00566
00567
00568
00569 s_copy(srnamc_1.srnamt, "CHPSVX", (ftnlen)32, (ftnlen)6);
00570 chpsvx_(fact, uplo, &n, nrhs, &a[1], &afac[1], &iwork[1],
00571 &b[1], &lda, &x[1], &lda, &rcond, &rwork[1], &
00572 rwork[*nrhs + 1], &work[1], &rwork[(*nrhs << 1) +
00573 1], &info);
00574
00575
00576
00577
00578 k = izero;
00579 if (k > 0) {
00580 L130:
00581 if (iwork[k] < 0) {
00582 if (iwork[k] != -k) {
00583 k = -iwork[k];
00584 goto L130;
00585 }
00586 } else if (iwork[k] != k) {
00587 k = iwork[k];
00588 goto L130;
00589 }
00590 }
00591
00592
00593
00594 if (info != k) {
00595
00596 i__6[0] = 1, a__1[0] = fact;
00597 i__6[1] = 1, a__1[1] = uplo;
00598 s_cat(ch__1, a__1, i__6, &c__2, (ftnlen)2);
00599 alaerh_(path, "CHPSVX", &info, &k, ch__1, &n, &n, &
00600 c_n1, &c_n1, nrhs, &imat, &nfail, &nerrs,
00601 nout);
00602 goto L150;
00603 }
00604
00605 if (info == 0) {
00606 if (ifact >= 2) {
00607
00608
00609
00610
00611 chpt01_(uplo, &n, &a[1], &afac[1], &iwork[1], &
00612 ainv[1], &lda, &rwork[(*nrhs << 1) + 1],
00613 result);
00614 k1 = 1;
00615 } else {
00616 k1 = 2;
00617 }
00618
00619
00620
00621 clacpy_("Full", &n, nrhs, &b[1], &lda, &work[1], &lda);
00622 cppt02_(uplo, &n, nrhs, &a[1], &x[1], &lda, &work[1],
00623 &lda, &rwork[(*nrhs << 1) + 1], &result[1]);
00624
00625
00626
00627 cget04_(&n, nrhs, &x[1], &lda, &xact[1], &lda, &
00628 rcondc, &result[2]);
00629
00630
00631
00632 cppt05_(uplo, &n, nrhs, &a[1], &b[1], &lda, &x[1], &
00633 lda, &xact[1], &lda, &rwork[1], &rwork[*nrhs
00634 + 1], &result[3]);
00635 } else {
00636 k1 = 6;
00637 }
00638
00639
00640
00641
00642 result[5] = sget06_(&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, "CHPSVX", (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(real));
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 }