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