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