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