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, iounit;
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 real c_b14 = 0.f;
00034 static real c_b15 = 1.f;
00035 static integer c__1 = 1;
00036 static integer c__0 = 0;
00037 static integer c__3 = 3;
00038 static integer c_n1 = -1;
00039 static integer c__6 = 6;
00040 static integer c__4 = 4;
00041 static integer c__7 = 7;
00042 static integer c__8 = 8;
00043
00044 int schktb_(logical *dotype, integer *nn, integer *nval,
00045 integer *nns, integer *nsval, real *thresh, logical *tsterr, integer *
00046 nmax, real *ab, real *ainv, real *b, real *x, real *xact, real *work,
00047 real *rwork, integer *iwork, integer *nout)
00048 {
00049
00050
00051 static integer iseedy[4] = { 1988,1989,1990,1991 };
00052 static char uplos[1*2] = "U" "L";
00053 static char transs[1*3] = "N" "T" "C";
00054
00055
00056 static char fmt_9999[] = "(\002 UPLO='\002,a1,\002', TRANS='\002,a1,\002"
00057 "', DIAG='\002,a1,\002', N=\002,i5,\002, K"
00058 "D=\002,i5,\002, NRHS=\002,i5,\002, type \002,i2,\002, test(\002,"
00059 "i2,\002)=\002,g12.5)";
00060 static char fmt_9998[] = "(1x,a,\002( '\002,a1,\002', '\002,a1,\002', "
00061 "'\002,a1,\002',\002,i5,\002,\002,i5,\002, ... ), type \002,i2"
00062 ",\002, test(\002,i2,\002)=\002,g12.5)";
00063 static char fmt_9997[] = "(1x,a,\002( '\002,a1,\002', '\002,a1,\002', "
00064 "'\002,a1,\002', '\002,a1,\002',\002,i5,\002,\002,i5,\002, ... )"
00065 ", type \002,i2,\002, test(\002,i1,\002)=\002,g12.5)";
00066
00067
00068 address a__1[3], a__2[4];
00069 integer i__1, i__2, i__3, i__4, i__5, i__6[3], i__7[4];
00070 char ch__1[3], ch__2[4];
00071
00072
00073 int s_copy(char *, char *, ftnlen, ftnlen), s_cat(char *,
00074 char **, integer *, integer *, ftnlen);
00075 integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
00076
00077
00078 integer i__, j, k, n, kd, ik, in, nk, lda, ldab;
00079 char diag[1];
00080 integer imat, info;
00081 char path[3];
00082 integer irhs, nrhs;
00083 char norm[1], uplo[1];
00084 integer nrun;
00085 extern int alahd_(integer *, char *);
00086 integer idiag;
00087 real scale;
00088 integer nfail, iseed[4];
00089 extern logical lsame_(char *, char *);
00090 real rcond;
00091 extern int sget04_(integer *, integer *, real *, integer
00092 *, real *, integer *, real *, real *);
00093 integer nimat;
00094 real anorm;
00095 integer itran;
00096 extern int stbt02_(char *, char *, char *, integer *,
00097 integer *, integer *, real *, integer *, real *, integer *, real *
00098 , integer *, real *, real *), stbt03_(
00099 char *, char *, char *, integer *, integer *, integer *, real *,
00100 integer *, real *, real *, real *, real *, integer *, real *,
00101 integer *, real *, real *), stbt05_(char *
00102 , char *, char *, integer *, integer *, integer *, real *,
00103 integer *, real *, integer *, real *, integer *, real *, integer *
00104 , real *, real *, real *), stbt06_(real *,
00105 real *, char *, char *, integer *, integer *, real *, integer *,
00106 real *, real *);
00107 char trans[1];
00108 integer iuplo, nerrs;
00109 extern int scopy_(integer *, real *, integer *, real *,
00110 integer *), stbsv_(char *, char *, char *, integer *, integer *,
00111 real *, integer *, real *, integer *);
00112 char xtype[1];
00113 integer nimat2;
00114 extern int alaerh_(char *, char *, integer *, integer *,
00115 char *, integer *, integer *, integer *, integer *, integer *,
00116 integer *, integer *, integer *, integer *);
00117 real rcondc, rcondi;
00118 extern doublereal slantb_(char *, char *, char *, integer *, integer *,
00119 real *, integer *, real *);
00120 real rcondo;
00121 extern int alasum_(char *, integer *, integer *, integer
00122 *, integer *);
00123 real ainvnm;
00124 extern int slatbs_(char *, char *, char *, char *,
00125 integer *, integer *, real *, integer *, real *, real *, real *,
00126 integer *), slattb_(integer *,
00127 char *, char *, char *, integer *, integer *, integer *, real *,
00128 integer *, real *, real *, integer *),
00129 slacpy_(char *, integer *, integer *, real *, integer *, real *,
00130 integer *), slarhs_(char *, char *, char *, char *,
00131 integer *, integer *, integer *, integer *, integer *, real *,
00132 integer *, real *, integer *, real *, integer *, integer *,
00133 integer *), slaset_(char *,
00134 integer *, integer *, real *, real *, real *, integer *),
00135 stbcon_(char *, char *, char *, integer *, integer *, real *,
00136 integer *, real *, real *, integer *, integer *);
00137 extern doublereal slantr_(char *, char *, char *, integer *, integer *,
00138 real *, integer *, real *);
00139 extern int stbrfs_(char *, char *, char *, integer *,
00140 integer *, integer *, real *, integer *, real *, integer *, real *
00141 , integer *, real *, real *, real *, integer *, integer *);
00142 real result[8];
00143 extern int serrtr_(char *, integer *), stbtrs_(
00144 char *, char *, char *, integer *, integer *, integer *, real *,
00145 integer *, real *, integer *, integer *);
00146
00147
00148 static cilist io___39 = { 0, 0, 0, fmt_9999, 0 };
00149 static cilist io___41 = { 0, 0, 0, fmt_9998, 0 };
00150 static cilist io___43 = { 0, 0, 0, fmt_9997, 0 };
00151 static cilist io___44 = { 0, 0, 0, fmt_9997, 0 };
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
00235
00236
00237
00238
00239
00240
00241
00242
00243 --iwork;
00244 --rwork;
00245 --work;
00246 --xact;
00247 --x;
00248 --b;
00249 --ainv;
00250 --ab;
00251 --nsval;
00252 --nval;
00253 --dotype;
00254
00255
00256
00257
00258
00259
00260
00261 s_copy(path, "Single precision", (ftnlen)1, (ftnlen)16);
00262 s_copy(path + 1, "TB", (ftnlen)2, (ftnlen)2);
00263 nrun = 0;
00264 nfail = 0;
00265 nerrs = 0;
00266 for (i__ = 1; i__ <= 4; ++i__) {
00267 iseed[i__ - 1] = iseedy[i__ - 1];
00268
00269 }
00270
00271
00272
00273 if (*tsterr) {
00274 serrtr_(path, nout);
00275 }
00276 infoc_1.infot = 0;
00277
00278 i__1 = *nn;
00279 for (in = 1; in <= i__1; ++in) {
00280
00281
00282
00283 n = nval[in];
00284 lda = max(1,n);
00285 *(unsigned char *)xtype = 'N';
00286 nimat = 9;
00287 nimat2 = 17;
00288 if (n <= 0) {
00289 nimat = 1;
00290 nimat2 = 10;
00291 }
00292
00293
00294 i__2 = n + 1;
00295 nk = min(i__2,4);
00296 i__2 = nk;
00297 for (ik = 1; ik <= i__2; ++ik) {
00298
00299
00300
00301
00302 if (ik == 1) {
00303 kd = 0;
00304 } else if (ik == 2) {
00305 kd = max(n,0);
00306 } else if (ik == 3) {
00307 kd = (n * 3 - 1) / 4;
00308 } else if (ik == 4) {
00309 kd = (n + 1) / 4;
00310 }
00311 ldab = kd + 1;
00312
00313 i__3 = nimat;
00314 for (imat = 1; imat <= i__3; ++imat) {
00315
00316
00317
00318 if (! dotype[imat]) {
00319 goto L90;
00320 }
00321
00322 for (iuplo = 1; iuplo <= 2; ++iuplo) {
00323
00324
00325
00326 *(unsigned char *)uplo = *(unsigned char *)&uplos[iuplo -
00327 1];
00328
00329
00330
00331 s_copy(srnamc_1.srnamt, "SLATTB", (ftnlen)32, (ftnlen)6);
00332 slattb_(&imat, uplo, "No transpose", diag, iseed, &n, &kd,
00333 &ab[1], &ldab, &x[1], &work[1], &info);
00334
00335
00336
00337 if (lsame_(diag, "N")) {
00338 idiag = 1;
00339 } else {
00340 idiag = 2;
00341 }
00342
00343
00344
00345
00346 slaset_("Full", &n, &n, &c_b14, &c_b15, &ainv[1], &lda);
00347 if (lsame_(uplo, "U")) {
00348 i__4 = n;
00349 for (j = 1; j <= i__4; ++j) {
00350 stbsv_(uplo, "No transpose", diag, &j, &kd, &ab[1]
00351 , &ldab, &ainv[(j - 1) * lda + 1], &c__1);
00352
00353 }
00354 } else {
00355 i__4 = n;
00356 for (j = 1; j <= i__4; ++j) {
00357 i__5 = n - j + 1;
00358 stbsv_(uplo, "No transpose", diag, &i__5, &kd, &
00359 ab[(j - 1) * ldab + 1], &ldab, &ainv[(j -
00360 1) * lda + j], &c__1);
00361
00362 }
00363 }
00364
00365
00366
00367 anorm = slantb_("1", uplo, diag, &n, &kd, &ab[1], &ldab, &
00368 rwork[1]);
00369 ainvnm = slantr_("1", uplo, diag, &n, &n, &ainv[1], &lda,
00370 &rwork[1]);
00371 if (anorm <= 0.f || ainvnm <= 0.f) {
00372 rcondo = 1.f;
00373 } else {
00374 rcondo = 1.f / anorm / ainvnm;
00375 }
00376
00377
00378
00379 anorm = slantb_("I", uplo, diag, &n, &kd, &ab[1], &ldab, &
00380 rwork[1]);
00381 ainvnm = slantr_("I", uplo, diag, &n, &n, &ainv[1], &lda,
00382 &rwork[1]);
00383 if (anorm <= 0.f || ainvnm <= 0.f) {
00384 rcondi = 1.f;
00385 } else {
00386 rcondi = 1.f / anorm / ainvnm;
00387 }
00388
00389 i__4 = *nns;
00390 for (irhs = 1; irhs <= i__4; ++irhs) {
00391 nrhs = nsval[irhs];
00392 *(unsigned char *)xtype = 'N';
00393
00394 for (itran = 1; itran <= 3; ++itran) {
00395
00396
00397
00398 *(unsigned char *)trans = *(unsigned char *)&
00399 transs[itran - 1];
00400 if (itran == 1) {
00401 *(unsigned char *)norm = 'O';
00402 rcondc = rcondo;
00403 } else {
00404 *(unsigned char *)norm = 'I';
00405 rcondc = rcondi;
00406 }
00407
00408
00409
00410
00411 s_copy(srnamc_1.srnamt, "SLARHS", (ftnlen)32, (
00412 ftnlen)6);
00413 slarhs_(path, xtype, uplo, trans, &n, &n, &kd, &
00414 idiag, &nrhs, &ab[1], &ldab, &xact[1], &
00415 lda, &b[1], &lda, iseed, &info);
00416 *(unsigned char *)xtype = 'C';
00417 slacpy_("Full", &n, &nrhs, &b[1], &lda, &x[1], &
00418 lda);
00419
00420 s_copy(srnamc_1.srnamt, "STBTRS", (ftnlen)32, (
00421 ftnlen)6);
00422 stbtrs_(uplo, trans, diag, &n, &kd, &nrhs, &ab[1],
00423 &ldab, &x[1], &lda, &info);
00424
00425
00426
00427 if (info != 0) {
00428
00429 i__6[0] = 1, a__1[0] = uplo;
00430 i__6[1] = 1, a__1[1] = trans;
00431 i__6[2] = 1, a__1[2] = diag;
00432 s_cat(ch__1, a__1, i__6, &c__3, (ftnlen)3);
00433 alaerh_(path, "STBTRS", &info, &c__0, ch__1, &
00434 n, &n, &kd, &kd, &nrhs, &imat, &nfail,
00435 &nerrs, nout);
00436 }
00437
00438 stbt02_(uplo, trans, diag, &n, &kd, &nrhs, &ab[1],
00439 &ldab, &x[1], &lda, &b[1], &lda, &work[1]
00440 , result)
00441 ;
00442
00443
00444
00445
00446 sget04_(&n, &nrhs, &x[1], &lda, &xact[1], &lda, &
00447 rcondc, &result[1]);
00448
00449
00450
00451
00452
00453 s_copy(srnamc_1.srnamt, "STBRFS", (ftnlen)32, (
00454 ftnlen)6);
00455 stbrfs_(uplo, trans, diag, &n, &kd, &nrhs, &ab[1],
00456 &ldab, &b[1], &lda, &x[1], &lda, &rwork[
00457 1], &rwork[nrhs + 1], &work[1], &iwork[1],
00458 &info);
00459
00460
00461
00462 if (info != 0) {
00463
00464 i__6[0] = 1, a__1[0] = uplo;
00465 i__6[1] = 1, a__1[1] = trans;
00466 i__6[2] = 1, a__1[2] = diag;
00467 s_cat(ch__1, a__1, i__6, &c__3, (ftnlen)3);
00468 alaerh_(path, "STBRFS", &info, &c__0, ch__1, &
00469 n, &n, &kd, &kd, &nrhs, &imat, &nfail,
00470 &nerrs, nout);
00471 }
00472
00473 sget04_(&n, &nrhs, &x[1], &lda, &xact[1], &lda, &
00474 rcondc, &result[2]);
00475 stbt05_(uplo, trans, diag, &n, &kd, &nrhs, &ab[1],
00476 &ldab, &b[1], &lda, &x[1], &lda, &xact[1]
00477 , &lda, &rwork[1], &rwork[nrhs + 1], &
00478 result[3]);
00479
00480
00481
00482
00483 for (k = 1; k <= 5; ++k) {
00484 if (result[k - 1] >= *thresh) {
00485 if (nfail == 0 && nerrs == 0) {
00486 alahd_(nout, path);
00487 }
00488 io___39.ciunit = *nout;
00489 s_wsfe(&io___39);
00490 do_fio(&c__1, uplo, (ftnlen)1);
00491 do_fio(&c__1, trans, (ftnlen)1);
00492 do_fio(&c__1, diag, (ftnlen)1);
00493 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(
00494 integer));
00495 do_fio(&c__1, (char *)&kd, (ftnlen)sizeof(
00496 integer));
00497 do_fio(&c__1, (char *)&nrhs, (ftnlen)
00498 sizeof(integer));
00499 do_fio(&c__1, (char *)&imat, (ftnlen)
00500 sizeof(integer));
00501 do_fio(&c__1, (char *)&k, (ftnlen)sizeof(
00502 integer));
00503 do_fio(&c__1, (char *)&result[k - 1], (
00504 ftnlen)sizeof(real));
00505 e_wsfe();
00506 ++nfail;
00507 }
00508
00509 }
00510 nrun += 5;
00511
00512 }
00513
00514 }
00515
00516
00517
00518
00519 for (itran = 1; itran <= 2; ++itran) {
00520 if (itran == 1) {
00521 *(unsigned char *)norm = 'O';
00522 rcondc = rcondo;
00523 } else {
00524 *(unsigned char *)norm = 'I';
00525 rcondc = rcondi;
00526 }
00527 s_copy(srnamc_1.srnamt, "STBCON", (ftnlen)32, (ftnlen)
00528 6);
00529 stbcon_(norm, uplo, diag, &n, &kd, &ab[1], &ldab, &
00530 rcond, &work[1], &iwork[1], &info);
00531
00532
00533
00534 if (info != 0) {
00535
00536 i__6[0] = 1, a__1[0] = norm;
00537 i__6[1] = 1, a__1[1] = uplo;
00538 i__6[2] = 1, a__1[2] = diag;
00539 s_cat(ch__1, a__1, i__6, &c__3, (ftnlen)3);
00540 alaerh_(path, "STBCON", &info, &c__0, ch__1, &n, &
00541 n, &kd, &kd, &c_n1, &imat, &nfail, &nerrs,
00542 nout);
00543 }
00544
00545 stbt06_(&rcond, &rcondc, uplo, diag, &n, &kd, &ab[1],
00546 &ldab, &rwork[1], &result[5]);
00547
00548
00549
00550
00551 if (result[5] >= *thresh) {
00552 if (nfail == 0 && nerrs == 0) {
00553 alahd_(nout, path);
00554 }
00555 io___41.ciunit = *nout;
00556 s_wsfe(&io___41);
00557 do_fio(&c__1, "STBCON", (ftnlen)6);
00558 do_fio(&c__1, norm, (ftnlen)1);
00559 do_fio(&c__1, uplo, (ftnlen)1);
00560 do_fio(&c__1, diag, (ftnlen)1);
00561 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer))
00562 ;
00563 do_fio(&c__1, (char *)&kd, (ftnlen)sizeof(integer)
00564 );
00565 do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(
00566 integer));
00567 do_fio(&c__1, (char *)&c__6, (ftnlen)sizeof(
00568 integer));
00569 do_fio(&c__1, (char *)&result[5], (ftnlen)sizeof(
00570 real));
00571 e_wsfe();
00572 ++nfail;
00573 }
00574 ++nrun;
00575
00576 }
00577
00578 }
00579 L90:
00580 ;
00581 }
00582
00583
00584
00585 i__3 = nimat2;
00586 for (imat = 10; imat <= i__3; ++imat) {
00587
00588
00589
00590 if (! dotype[imat]) {
00591 goto L120;
00592 }
00593
00594 for (iuplo = 1; iuplo <= 2; ++iuplo) {
00595
00596
00597
00598 *(unsigned char *)uplo = *(unsigned char *)&uplos[iuplo -
00599 1];
00600 for (itran = 1; itran <= 3; ++itran) {
00601
00602
00603
00604 *(unsigned char *)trans = *(unsigned char *)&transs[
00605 itran - 1];
00606
00607
00608
00609 s_copy(srnamc_1.srnamt, "SLATTB", (ftnlen)32, (ftnlen)
00610 6);
00611 slattb_(&imat, uplo, trans, diag, iseed, &n, &kd, &ab[
00612 1], &ldab, &x[1], &work[1], &info);
00613
00614
00615
00616
00617 s_copy(srnamc_1.srnamt, "SLATBS", (ftnlen)32, (ftnlen)
00618 6);
00619 scopy_(&n, &x[1], &c__1, &b[1], &c__1);
00620 slatbs_(uplo, trans, diag, "N", &n, &kd, &ab[1], &
00621 ldab, &b[1], &scale, &rwork[1], &info);
00622
00623
00624
00625 if (info != 0) {
00626
00627 i__7[0] = 1, a__2[0] = uplo;
00628 i__7[1] = 1, a__2[1] = trans;
00629 i__7[2] = 1, a__2[2] = diag;
00630 i__7[3] = 1, a__2[3] = "N";
00631 s_cat(ch__2, a__2, i__7, &c__4, (ftnlen)4);
00632 alaerh_(path, "SLATBS", &info, &c__0, ch__2, &n, &
00633 n, &kd, &kd, &c_n1, &imat, &nfail, &nerrs,
00634 nout);
00635 }
00636
00637 stbt03_(uplo, trans, diag, &n, &kd, &c__1, &ab[1], &
00638 ldab, &scale, &rwork[1], &c_b15, &b[1], &lda,
00639 &x[1], &lda, &work[1], &result[6]);
00640
00641
00642
00643
00644 scopy_(&n, &x[1], &c__1, &b[1], &c__1);
00645 slatbs_(uplo, trans, diag, "Y", &n, &kd, &ab[1], &
00646 ldab, &b[1], &scale, &rwork[1], &info);
00647
00648
00649
00650 if (info != 0) {
00651
00652 i__7[0] = 1, a__2[0] = uplo;
00653 i__7[1] = 1, a__2[1] = trans;
00654 i__7[2] = 1, a__2[2] = diag;
00655 i__7[3] = 1, a__2[3] = "Y";
00656 s_cat(ch__2, a__2, i__7, &c__4, (ftnlen)4);
00657 alaerh_(path, "SLATBS", &info, &c__0, ch__2, &n, &
00658 n, &kd, &kd, &c_n1, &imat, &nfail, &nerrs,
00659 nout);
00660 }
00661
00662 stbt03_(uplo, trans, diag, &n, &kd, &c__1, &ab[1], &
00663 ldab, &scale, &rwork[1], &c_b15, &b[1], &lda,
00664 &x[1], &lda, &work[1], &result[7]);
00665
00666
00667
00668
00669 if (result[6] >= *thresh) {
00670 if (nfail == 0 && nerrs == 0) {
00671 alahd_(nout, path);
00672 }
00673 io___43.ciunit = *nout;
00674 s_wsfe(&io___43);
00675 do_fio(&c__1, "SLATBS", (ftnlen)6);
00676 do_fio(&c__1, uplo, (ftnlen)1);
00677 do_fio(&c__1, trans, (ftnlen)1);
00678 do_fio(&c__1, diag, (ftnlen)1);
00679 do_fio(&c__1, "N", (ftnlen)1);
00680 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer))
00681 ;
00682 do_fio(&c__1, (char *)&kd, (ftnlen)sizeof(integer)
00683 );
00684 do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(
00685 integer));
00686 do_fio(&c__1, (char *)&c__7, (ftnlen)sizeof(
00687 integer));
00688 do_fio(&c__1, (char *)&result[6], (ftnlen)sizeof(
00689 real));
00690 e_wsfe();
00691 ++nfail;
00692 }
00693 if (result[7] >= *thresh) {
00694 if (nfail == 0 && nerrs == 0) {
00695 alahd_(nout, path);
00696 }
00697 io___44.ciunit = *nout;
00698 s_wsfe(&io___44);
00699 do_fio(&c__1, "SLATBS", (ftnlen)6);
00700 do_fio(&c__1, uplo, (ftnlen)1);
00701 do_fio(&c__1, trans, (ftnlen)1);
00702 do_fio(&c__1, diag, (ftnlen)1);
00703 do_fio(&c__1, "Y", (ftnlen)1);
00704 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer))
00705 ;
00706 do_fio(&c__1, (char *)&kd, (ftnlen)sizeof(integer)
00707 );
00708 do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(
00709 integer));
00710 do_fio(&c__1, (char *)&c__8, (ftnlen)sizeof(
00711 integer));
00712 do_fio(&c__1, (char *)&result[7], (ftnlen)sizeof(
00713 real));
00714 e_wsfe();
00715 ++nfail;
00716 }
00717 nrun += 2;
00718
00719 }
00720
00721 }
00722 L120:
00723 ;
00724 }
00725
00726 }
00727
00728 }
00729
00730
00731
00732 alasum_(path, nout, &nfail, &nrun, &nerrs);
00733
00734 return 0;
00735
00736
00737
00738 }