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__3 = 3;
00034 static integer c__0 = 0;
00035 static integer c_n1 = -1;
00036 static integer c__1 = 1;
00037 static integer c__2 = 2;
00038 static integer c__7 = 7;
00039 static real c_b63 = 1.f;
00040 static real c_b64 = 0.f;
00041
00042 int schkgt_(logical *dotype, integer *nn, integer *nval,
00043 integer *nns, integer *nsval, real *thresh, logical *tsterr, real *a,
00044 real *af, real *b, real *x, real *xact, real *work, real *rwork,
00045 integer *iwork, integer *nout)
00046 {
00047
00048
00049 static integer iseedy[4] = { 0,0,0,1 };
00050 static char transs[1*3] = "N" "T" "C";
00051
00052
00053 static char fmt_9999[] = "(12x,\002N =\002,i5,\002,\002,10x,\002 type"
00054 " \002,i2,\002, test(\002,i2,\002) = \002,g12.5)";
00055 static char fmt_9997[] = "(\002 NORM ='\002,a1,\002', N =\002,i5,\002"
00056 ",\002,10x,\002 type \002,i2,\002, test(\002,i2,\002) = \002,g12."
00057 "5)";
00058 static char fmt_9998[] = "(\002 TRANS='\002,a1,\002', N =\002,i5,\002, N"
00059 "RHS=\002,i3,\002, type \002,i2,\002, test(\002,i2,\002) = \002,g"
00060 "12.5)";
00061
00062
00063 integer i__1, i__2, i__3, i__4;
00064 real r__1, r__2;
00065
00066
00067 int s_copy(char *, char *, ftnlen, ftnlen);
00068 integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
00069
00070
00071 integer i__, j, k, m, n;
00072 real z__[3];
00073 integer in, kl, ku, ix, lda;
00074 real cond;
00075 integer mode, koff, imat, info;
00076 char path[3], dist[1];
00077 integer irhs, nrhs;
00078 char norm[1], type__[1];
00079 integer nrun;
00080 extern int alahd_(integer *, char *);
00081 integer nfail, iseed[4];
00082 real rcond;
00083 extern int sget04_(integer *, integer *, real *, integer
00084 *, real *, integer *, real *, real *), sscal_(integer *, real *,
00085 real *, integer *);
00086 integer nimat;
00087 extern doublereal sget06_(real *, real *);
00088 real anorm;
00089 integer itran;
00090 extern int sgtt01_(integer *, real *, real *, real *,
00091 real *, real *, real *, real *, integer *, real *, integer *,
00092 real *, real *), sgtt02_(char *, integer *, integer *, real *,
00093 real *, real *, real *, integer *, real *, integer *, real *,
00094 real *), sgtt05_(char *, integer *, integer *, real *,
00095 real *, real *, real *, integer *, real *, integer *, real *,
00096 integer *, real *, real *, real *);
00097 char trans[1];
00098 integer izero, nerrs;
00099 extern doublereal sasum_(integer *, real *, integer *);
00100 extern int scopy_(integer *, real *, integer *, real *,
00101 integer *);
00102 logical zerot;
00103 extern int slatb4_(char *, integer *, integer *, integer
00104 *, char *, integer *, integer *, real *, integer *, real *, char *
00105 ), alaerh_(char *, char *, integer *,
00106 integer *, char *, integer *, integer *, integer *, integer *,
00107 integer *, integer *, integer *, integer *, integer *);
00108 real rcondc, rcondi, rcondo;
00109 extern int alasum_(char *, integer *, integer *, integer
00110 *, integer *), serrge_(char *, integer *);
00111 real ainvnm;
00112 extern doublereal slangt_(char *, integer *, real *, real *, real *);
00113 extern int slagtm_(char *, integer *, integer *, real *,
00114 real *, real *, real *, real *, integer *, real *, real *,
00115 integer *);
00116 logical trfcon;
00117 extern int slacpy_(char *, integer *, integer *, real *,
00118 integer *, real *, integer *), sgtcon_(char *, integer *,
00119 real *, real *, real *, real *, integer *, real *, real *, real *,
00120 integer *, integer *), slatms_(integer *, integer *,
00121 char *, integer *, char *, real *, integer *, real *, real *,
00122 integer *, integer *, char *, real *, integer *, real *, integer *
00123 ), slarnv_(integer *, integer *, integer *
00124 , real *), sgtrfs_(char *, integer *, integer *, real *, real *,
00125 real *, real *, real *, real *, real *, integer *, real *,
00126 integer *, real *, integer *, real *, real *, real *, integer *,
00127 integer *), sgttrf_(integer *, real *, real *, real *,
00128 real *, integer *, integer *);
00129 real result[7];
00130 extern int sgttrs_(char *, integer *, integer *, real *,
00131 real *, real *, real *, integer *, real *, integer *, integer *);
00132
00133
00134 static cilist io___29 = { 0, 0, 0, fmt_9999, 0 };
00135 static cilist io___39 = { 0, 0, 0, fmt_9997, 0 };
00136 static cilist io___44 = { 0, 0, 0, fmt_9998, 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 --iwork;
00225 --rwork;
00226 --work;
00227 --xact;
00228 --x;
00229 --b;
00230 --af;
00231 --a;
00232 --nsval;
00233 --nval;
00234 --dotype;
00235
00236
00237
00238
00239
00240 s_copy(path, "Single precision", (ftnlen)1, (ftnlen)16);
00241 s_copy(path + 1, "GT", (ftnlen)2, (ftnlen)2);
00242 nrun = 0;
00243 nfail = 0;
00244 nerrs = 0;
00245 for (i__ = 1; i__ <= 4; ++i__) {
00246 iseed[i__ - 1] = iseedy[i__ - 1];
00247
00248 }
00249
00250
00251
00252 if (*tsterr) {
00253 serrge_(path, nout);
00254 }
00255 infoc_1.infot = 0;
00256
00257 i__1 = *nn;
00258 for (in = 1; in <= i__1; ++in) {
00259
00260
00261
00262 n = nval[in];
00263
00264 i__2 = n - 1;
00265 m = max(i__2,0);
00266 lda = max(1,n);
00267 nimat = 12;
00268 if (n <= 0) {
00269 nimat = 1;
00270 }
00271
00272 i__2 = nimat;
00273 for (imat = 1; imat <= i__2; ++imat) {
00274
00275
00276
00277 if (! dotype[imat]) {
00278 goto L100;
00279 }
00280
00281
00282
00283 slatb4_(path, &imat, &n, &n, type__, &kl, &ku, &anorm, &mode, &
00284 cond, dist);
00285
00286 zerot = imat >= 8 && imat <= 10;
00287 if (imat <= 6) {
00288
00289
00290
00291
00292 i__3 = 2 - ku, i__4 = 3 - max(1,n);
00293 koff = max(i__3,i__4);
00294 s_copy(srnamc_1.srnamt, "SLATMS", (ftnlen)32, (ftnlen)6);
00295 slatms_(&n, &n, dist, iseed, type__, &rwork[1], &mode, &cond,
00296 &anorm, &kl, &ku, "Z", &af[koff], &c__3, &work[1], &
00297 info);
00298
00299
00300
00301 if (info != 0) {
00302 alaerh_(path, "SLATMS", &info, &c__0, " ", &n, &n, &kl, &
00303 ku, &c_n1, &imat, &nfail, &nerrs, nout);
00304 goto L100;
00305 }
00306 izero = 0;
00307
00308 if (n > 1) {
00309 i__3 = n - 1;
00310 scopy_(&i__3, &af[4], &c__3, &a[1], &c__1);
00311 i__3 = n - 1;
00312 scopy_(&i__3, &af[3], &c__3, &a[n + m + 1], &c__1);
00313 }
00314 scopy_(&n, &af[2], &c__3, &a[m + 1], &c__1);
00315 } else {
00316
00317
00318
00319
00320 if (! zerot || ! dotype[7]) {
00321
00322
00323
00324 i__3 = n + (m << 1);
00325 slarnv_(&c__2, iseed, &i__3, &a[1]);
00326 if (anorm != 1.f) {
00327 i__3 = n + (m << 1);
00328 sscal_(&i__3, &anorm, &a[1], &c__1);
00329 }
00330 } else if (izero > 0) {
00331
00332
00333
00334
00335 if (izero == 1) {
00336 a[n] = z__[1];
00337 if (n > 1) {
00338 a[1] = z__[2];
00339 }
00340 } else if (izero == n) {
00341 a[n * 3 - 2] = z__[0];
00342 a[(n << 1) - 1] = z__[1];
00343 } else {
00344 a[(n << 1) - 2 + izero] = z__[0];
00345 a[n - 1 + izero] = z__[1];
00346 a[izero] = z__[2];
00347 }
00348 }
00349
00350
00351
00352 if (! zerot) {
00353 izero = 0;
00354 } else if (imat == 8) {
00355 izero = 1;
00356 z__[1] = a[n];
00357 a[n] = 0.f;
00358 if (n > 1) {
00359 z__[2] = a[1];
00360 a[1] = 0.f;
00361 }
00362 } else if (imat == 9) {
00363 izero = n;
00364 z__[0] = a[n * 3 - 2];
00365 z__[1] = a[(n << 1) - 1];
00366 a[n * 3 - 2] = 0.f;
00367 a[(n << 1) - 1] = 0.f;
00368 } else {
00369 izero = (n + 1) / 2;
00370 i__3 = n - 1;
00371 for (i__ = izero; i__ <= i__3; ++i__) {
00372 a[(n << 1) - 2 + i__] = 0.f;
00373 a[n - 1 + i__] = 0.f;
00374 a[i__] = 0.f;
00375
00376 }
00377 a[n * 3 - 2] = 0.f;
00378 a[(n << 1) - 1] = 0.f;
00379 }
00380 }
00381
00382
00383
00384
00385
00386 i__3 = n + (m << 1);
00387 scopy_(&i__3, &a[1], &c__1, &af[1], &c__1);
00388 s_copy(srnamc_1.srnamt, "SGTTRF", (ftnlen)32, (ftnlen)6);
00389 sgttrf_(&n, &af[1], &af[m + 1], &af[n + m + 1], &af[n + (m << 1)
00390 + 1], &iwork[1], &info);
00391
00392
00393
00394 if (info != izero) {
00395 alaerh_(path, "SGTTRF", &info, &izero, " ", &n, &n, &c__1, &
00396 c__1, &c_n1, &imat, &nfail, &nerrs, nout);
00397 }
00398 trfcon = info != 0;
00399
00400 sgtt01_(&n, &a[1], &a[m + 1], &a[n + m + 1], &af[1], &af[m + 1], &
00401 af[n + m + 1], &af[n + (m << 1) + 1], &iwork[1], &work[1],
00402 &lda, &rwork[1], result);
00403
00404
00405
00406 if (result[0] >= *thresh) {
00407 if (nfail == 0 && nerrs == 0) {
00408 alahd_(nout, path);
00409 }
00410 io___29.ciunit = *nout;
00411 s_wsfe(&io___29);
00412 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00413 do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(integer));
00414 do_fio(&c__1, (char *)&c__1, (ftnlen)sizeof(integer));
00415 do_fio(&c__1, (char *)&result[0], (ftnlen)sizeof(real));
00416 e_wsfe();
00417 ++nfail;
00418 }
00419 ++nrun;
00420
00421 for (itran = 1; itran <= 2; ++itran) {
00422 *(unsigned char *)trans = *(unsigned char *)&transs[itran - 1]
00423 ;
00424 if (itran == 1) {
00425 *(unsigned char *)norm = 'O';
00426 } else {
00427 *(unsigned char *)norm = 'I';
00428 }
00429 anorm = slangt_(norm, &n, &a[1], &a[m + 1], &a[n + m + 1]);
00430
00431 if (! trfcon) {
00432
00433
00434
00435
00436
00437 ainvnm = 0.f;
00438 i__3 = n;
00439 for (i__ = 1; i__ <= i__3; ++i__) {
00440 i__4 = n;
00441 for (j = 1; j <= i__4; ++j) {
00442 x[j] = 0.f;
00443
00444 }
00445 x[i__] = 1.f;
00446 sgttrs_(trans, &n, &c__1, &af[1], &af[m + 1], &af[n +
00447 m + 1], &af[n + (m << 1) + 1], &iwork[1], &x[
00448 1], &lda, &info);
00449
00450 r__1 = ainvnm, r__2 = sasum_(&n, &x[1], &c__1);
00451 ainvnm = dmax(r__1,r__2);
00452
00453 }
00454
00455
00456
00457 if (anorm <= 0.f || ainvnm <= 0.f) {
00458 rcondc = 1.f;
00459 } else {
00460 rcondc = 1.f / anorm / ainvnm;
00461 }
00462 if (itran == 1) {
00463 rcondo = rcondc;
00464 } else {
00465 rcondi = rcondc;
00466 }
00467 } else {
00468 rcondc = 0.f;
00469 }
00470
00471
00472
00473
00474
00475 s_copy(srnamc_1.srnamt, "SGTCON", (ftnlen)32, (ftnlen)6);
00476 sgtcon_(norm, &n, &af[1], &af[m + 1], &af[n + m + 1], &af[n +
00477 (m << 1) + 1], &iwork[1], &anorm, &rcond, &work[1], &
00478 iwork[n + 1], &info);
00479
00480
00481
00482 if (info != 0) {
00483 alaerh_(path, "SGTCON", &info, &c__0, norm, &n, &n, &c_n1,
00484 &c_n1, &c_n1, &imat, &nfail, &nerrs, nout);
00485 }
00486
00487 result[6] = sget06_(&rcond, &rcondc);
00488
00489
00490
00491 if (result[6] >= *thresh) {
00492 if (nfail == 0 && nerrs == 0) {
00493 alahd_(nout, path);
00494 }
00495 io___39.ciunit = *nout;
00496 s_wsfe(&io___39);
00497 do_fio(&c__1, norm, (ftnlen)1);
00498 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00499 do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(integer));
00500 do_fio(&c__1, (char *)&c__7, (ftnlen)sizeof(integer));
00501 do_fio(&c__1, (char *)&result[6], (ftnlen)sizeof(real));
00502 e_wsfe();
00503 ++nfail;
00504 }
00505 ++nrun;
00506
00507 }
00508
00509
00510
00511 if (trfcon) {
00512 goto L100;
00513 }
00514
00515 i__3 = *nns;
00516 for (irhs = 1; irhs <= i__3; ++irhs) {
00517 nrhs = nsval[irhs];
00518
00519
00520
00521 ix = 1;
00522 i__4 = nrhs;
00523 for (j = 1; j <= i__4; ++j) {
00524 slarnv_(&c__2, iseed, &n, &xact[ix]);
00525 ix += lda;
00526
00527 }
00528
00529 for (itran = 1; itran <= 3; ++itran) {
00530 *(unsigned char *)trans = *(unsigned char *)&transs[itran
00531 - 1];
00532 if (itran == 1) {
00533 rcondc = rcondo;
00534 } else {
00535 rcondc = rcondi;
00536 }
00537
00538
00539
00540 slagtm_(trans, &n, &nrhs, &c_b63, &a[1], &a[m + 1], &a[n
00541 + m + 1], &xact[1], &lda, &c_b64, &b[1], &lda);
00542
00543
00544
00545
00546 slacpy_("Full", &n, &nrhs, &b[1], &lda, &x[1], &lda);
00547 s_copy(srnamc_1.srnamt, "SGTTRS", (ftnlen)32, (ftnlen)6);
00548 sgttrs_(trans, &n, &nrhs, &af[1], &af[m + 1], &af[n + m +
00549 1], &af[n + (m << 1) + 1], &iwork[1], &x[1], &lda,
00550 &info);
00551
00552
00553
00554 if (info != 0) {
00555 alaerh_(path, "SGTTRS", &info, &c__0, trans, &n, &n, &
00556 c_n1, &c_n1, &nrhs, &imat, &nfail, &nerrs,
00557 nout);
00558 }
00559
00560 slacpy_("Full", &n, &nrhs, &b[1], &lda, &work[1], &lda);
00561 sgtt02_(trans, &n, &nrhs, &a[1], &a[m + 1], &a[n + m + 1],
00562 &x[1], &lda, &work[1], &lda, &rwork[1], &result[
00563 1]);
00564
00565
00566
00567
00568 sget04_(&n, &nrhs, &x[1], &lda, &xact[1], &lda, &rcondc, &
00569 result[2]);
00570
00571
00572
00573
00574 s_copy(srnamc_1.srnamt, "SGTRFS", (ftnlen)32, (ftnlen)6);
00575 sgtrfs_(trans, &n, &nrhs, &a[1], &a[m + 1], &a[n + m + 1],
00576 &af[1], &af[m + 1], &af[n + m + 1], &af[n + (m <<
00577 1) + 1], &iwork[1], &b[1], &lda, &x[1], &lda, &
00578 rwork[1], &rwork[nrhs + 1], &work[1], &iwork[n +
00579 1], &info);
00580
00581
00582
00583 if (info != 0) {
00584 alaerh_(path, "SGTRFS", &info, &c__0, trans, &n, &n, &
00585 c_n1, &c_n1, &nrhs, &imat, &nfail, &nerrs,
00586 nout);
00587 }
00588
00589 sget04_(&n, &nrhs, &x[1], &lda, &xact[1], &lda, &rcondc, &
00590 result[3]);
00591 sgtt05_(trans, &n, &nrhs, &a[1], &a[m + 1], &a[n + m + 1],
00592 &b[1], &lda, &x[1], &lda, &xact[1], &lda, &rwork[
00593 1], &rwork[nrhs + 1], &result[4]);
00594
00595
00596
00597
00598 for (k = 2; k <= 6; ++k) {
00599 if (result[k - 1] >= *thresh) {
00600 if (nfail == 0 && nerrs == 0) {
00601 alahd_(nout, path);
00602 }
00603 io___44.ciunit = *nout;
00604 s_wsfe(&io___44);
00605 do_fio(&c__1, trans, (ftnlen)1);
00606 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer))
00607 ;
00608 do_fio(&c__1, (char *)&nrhs, (ftnlen)sizeof(
00609 integer));
00610 do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(
00611 integer));
00612 do_fio(&c__1, (char *)&k, (ftnlen)sizeof(integer))
00613 ;
00614 do_fio(&c__1, (char *)&result[k - 1], (ftnlen)
00615 sizeof(real));
00616 e_wsfe();
00617 ++nfail;
00618 }
00619
00620 }
00621 nrun += 5;
00622
00623 }
00624
00625 }
00626
00627 L100:
00628 ;
00629 }
00630
00631 }
00632
00633
00634
00635 alasum_(path, nout, &nfail, &nrun, &nerrs);
00636
00637 return 0;
00638
00639
00640
00641 }