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