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 doublereal c_b43 = 1.;
00039 static doublereal c_b44 = 0.;
00040 static doublecomplex c_b65 = {0.,0.};
00041
00042 int zdrvgt_(logical *dotype, integer *nn, integer *nval,
00043 integer *nrhs, doublereal *thresh, logical *tsterr, doublecomplex *a,
00044 doublecomplex *af, doublecomplex *b, doublecomplex *x, doublecomplex *
00045 xact, doublecomplex *work, doublereal *rwork, integer *iwork, integer
00046 *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[] = "(1x,a,\002, N =\002,i5,\002, type \002,i2,\002"
00055 ", test \002,i2,\002, ratio = \002,g12.5)";
00056 static char fmt_9998[] = "(1x,a,\002, FACT='\002,a1,\002', TRANS='\002,a"
00057 "1,\002', N =\002,i5,\002, type \002,i2,\002, test \002,i2,\002, "
00058 "ratio = \002,g12.5)";
00059
00060
00061 address a__1[2];
00062 integer i__1, i__2, i__3, i__4, i__5, i__6[2];
00063 doublereal d__1, d__2;
00064 char ch__1[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 int s_cat(char *, char **, integer *, integer *, ftnlen);
00070
00071
00072 integer i__, j, k, m, n;
00073 doublereal z__[3];
00074 integer k1, in, kl, ku, ix, nt, lda;
00075 char fact[1];
00076 doublereal cond;
00077 integer mode, koff, imat, info;
00078 char path[3], dist[1], type__[1];
00079 integer nrun, ifact, nfail, iseed[4];
00080 extern doublereal dget06_(doublereal *, doublereal *);
00081 doublereal rcond;
00082 integer nimat;
00083 doublereal anorm;
00084 integer itran;
00085 extern int zget04_(integer *, integer *, doublecomplex *,
00086 integer *, doublecomplex *, integer *, doublereal *, doublereal *
00087 );
00088 char trans[1];
00089 integer izero, nerrs;
00090 extern int zgtt01_(integer *, doublecomplex *,
00091 doublecomplex *, doublecomplex *, doublecomplex *, doublecomplex *
00092 , doublecomplex *, doublecomplex *, integer *, doublecomplex *,
00093 integer *, doublereal *, doublereal *), zgtt02_(char *, integer *,
00094 integer *, doublecomplex *, doublecomplex *, doublecomplex *,
00095 doublecomplex *, integer *, doublecomplex *, integer *,
00096 doublereal *, doublereal *), zgtt05_(char *, integer *,
00097 integer *, doublecomplex *, doublecomplex *, doublecomplex *,
00098 doublecomplex *, integer *, doublecomplex *, integer *,
00099 doublecomplex *, integer *, doublereal *, doublereal *,
00100 doublereal *);
00101 logical zerot;
00102 extern int zcopy_(integer *, doublecomplex *, integer *,
00103 doublecomplex *, integer *), zgtsv_(integer *, integer *,
00104 doublecomplex *, doublecomplex *, doublecomplex *, doublecomplex *
00105 , integer *, integer *), zlatb4_(char *, integer *, integer *,
00106 integer *, char *, integer *, integer *, doublereal *, integer *,
00107 doublereal *, char *), aladhd_(integer *,
00108 char *), alaerh_(char *, char *, integer *, integer *,
00109 char *, integer *, integer *, integer *, integer *, integer *,
00110 integer *, integer *, integer *, integer *);
00111 doublereal rcondc, rcondi;
00112 extern int zdscal_(integer *, doublereal *,
00113 doublecomplex *, integer *), alasvm_(char *, integer *, integer *,
00114 integer *, integer *);
00115 doublereal rcondo, anormi, ainvnm;
00116 logical trfcon;
00117 doublereal anormo;
00118 extern int zlagtm_(char *, integer *, integer *,
00119 doublereal *, doublecomplex *, doublecomplex *, doublecomplex *,
00120 doublecomplex *, integer *, doublereal *, doublecomplex *,
00121 integer *);
00122 extern doublereal zlangt_(char *, integer *, doublecomplex *,
00123 doublecomplex *, doublecomplex *);
00124 extern int zlacpy_(char *, integer *, integer *,
00125 doublecomplex *, integer *, doublecomplex *, integer *);
00126 extern doublereal dzasum_(integer *, doublecomplex *, integer *);
00127 extern int zlaset_(char *, integer *, integer *,
00128 doublecomplex *, doublecomplex *, doublecomplex *, integer *), zlatms_(integer *, integer *, char *, integer *, char *,
00129 doublereal *, integer *, doublereal *, doublereal *, integer *,
00130 integer *, char *, doublecomplex *, integer *, doublecomplex *,
00131 integer *), zlarnv_(integer *, integer *,
00132 integer *, doublecomplex *);
00133 doublereal result[6];
00134 extern int zgttrf_(integer *, doublecomplex *,
00135 doublecomplex *, doublecomplex *, doublecomplex *, integer *,
00136 integer *), zgttrs_(char *, integer *, integer *, doublecomplex *,
00137 doublecomplex *, doublecomplex *, doublecomplex *, integer *,
00138 doublecomplex *, integer *, integer *), zerrvx_(char *,
00139 integer *), zgtsvx_(char *, char *, integer *, integer *,
00140 doublecomplex *, doublecomplex *, doublecomplex *, doublecomplex *
00141 , doublecomplex *, doublecomplex *, doublecomplex *, integer *,
00142 doublecomplex *, integer *, doublecomplex *, integer *,
00143 doublereal *, doublereal *, doublereal *, doublecomplex *,
00144 doublereal *, integer *);
00145
00146
00147 static cilist io___42 = { 0, 0, 0, fmt_9999, 0 };
00148 static cilist io___46 = { 0, 0, 0, fmt_9998, 0 };
00149 static cilist io___47 = { 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 --iwork;
00230 --rwork;
00231 --work;
00232 --xact;
00233 --x;
00234 --b;
00235 --af;
00236 --a;
00237 --nval;
00238 --dotype;
00239
00240
00241
00242
00243
00244 s_copy(path, "Zomplex precision", (ftnlen)1, (ftnlen)17);
00245 s_copy(path + 1, "GT", (ftnlen)2, (ftnlen)2);
00246 nrun = 0;
00247 nfail = 0;
00248 nerrs = 0;
00249 for (i__ = 1; i__ <= 4; ++i__) {
00250 iseed[i__ - 1] = iseedy[i__ - 1];
00251
00252 }
00253
00254
00255
00256 if (*tsterr) {
00257 zerrvx_(path, nout);
00258 }
00259 infoc_1.infot = 0;
00260
00261 i__1 = *nn;
00262 for (in = 1; in <= i__1; ++in) {
00263
00264
00265
00266 n = nval[in];
00267
00268 i__2 = n - 1;
00269 m = max(i__2,0);
00270 lda = max(1,n);
00271 nimat = 12;
00272 if (n <= 0) {
00273 nimat = 1;
00274 }
00275
00276 i__2 = nimat;
00277 for (imat = 1; imat <= i__2; ++imat) {
00278
00279
00280
00281 if (! dotype[imat]) {
00282 goto L130;
00283 }
00284
00285
00286
00287 zlatb4_(path, &imat, &n, &n, type__, &kl, &ku, &anorm, &mode, &
00288 cond, dist);
00289
00290 zerot = imat >= 8 && imat <= 10;
00291 if (imat <= 6) {
00292
00293
00294
00295
00296 i__3 = 2 - ku, i__4 = 3 - max(1,n);
00297 koff = max(i__3,i__4);
00298 s_copy(srnamc_1.srnamt, "ZLATMS", (ftnlen)32, (ftnlen)6);
00299 zlatms_(&n, &n, dist, iseed, type__, &rwork[1], &mode, &cond,
00300 &anorm, &kl, &ku, "Z", &af[koff], &c__3, &work[1], &
00301 info);
00302
00303
00304
00305 if (info != 0) {
00306 alaerh_(path, "ZLATMS", &info, &c__0, " ", &n, &n, &kl, &
00307 ku, &c_n1, &imat, &nfail, &nerrs, nout);
00308 goto L130;
00309 }
00310 izero = 0;
00311
00312 if (n > 1) {
00313 i__3 = n - 1;
00314 zcopy_(&i__3, &af[4], &c__3, &a[1], &c__1);
00315 i__3 = n - 1;
00316 zcopy_(&i__3, &af[3], &c__3, &a[n + m + 1], &c__1);
00317 }
00318 zcopy_(&n, &af[2], &c__3, &a[m + 1], &c__1);
00319 } else {
00320
00321
00322
00323
00324 if (! zerot || ! dotype[7]) {
00325
00326
00327
00328 i__3 = n + (m << 1);
00329 zlarnv_(&c__2, iseed, &i__3, &a[1]);
00330 if (anorm != 1.) {
00331 i__3 = n + (m << 1);
00332 zdscal_(&i__3, &anorm, &a[1], &c__1);
00333 }
00334 } else if (izero > 0) {
00335
00336
00337
00338
00339 if (izero == 1) {
00340 i__3 = n;
00341 a[i__3].r = z__[1], a[i__3].i = 0.;
00342 if (n > 1) {
00343 a[1].r = z__[2], a[1].i = 0.;
00344 }
00345 } else if (izero == n) {
00346 i__3 = n * 3 - 2;
00347 a[i__3].r = z__[0], a[i__3].i = 0.;
00348 i__3 = (n << 1) - 1;
00349 a[i__3].r = z__[1], a[i__3].i = 0.;
00350 } else {
00351 i__3 = (n << 1) - 2 + izero;
00352 a[i__3].r = z__[0], a[i__3].i = 0.;
00353 i__3 = n - 1 + izero;
00354 a[i__3].r = z__[1], a[i__3].i = 0.;
00355 i__3 = izero;
00356 a[i__3].r = z__[2], a[i__3].i = 0.;
00357 }
00358 }
00359
00360
00361
00362 if (! zerot) {
00363 izero = 0;
00364 } else if (imat == 8) {
00365 izero = 1;
00366 i__3 = n;
00367 z__[1] = a[i__3].r;
00368 i__3 = n;
00369 a[i__3].r = 0., a[i__3].i = 0.;
00370 if (n > 1) {
00371 z__[2] = a[1].r;
00372 a[1].r = 0., a[1].i = 0.;
00373 }
00374 } else if (imat == 9) {
00375 izero = n;
00376 i__3 = n * 3 - 2;
00377 z__[0] = a[i__3].r;
00378 i__3 = (n << 1) - 1;
00379 z__[1] = a[i__3].r;
00380 i__3 = n * 3 - 2;
00381 a[i__3].r = 0., a[i__3].i = 0.;
00382 i__3 = (n << 1) - 1;
00383 a[i__3].r = 0., a[i__3].i = 0.;
00384 } else {
00385 izero = (n + 1) / 2;
00386 i__3 = n - 1;
00387 for (i__ = izero; i__ <= i__3; ++i__) {
00388 i__4 = (n << 1) - 2 + i__;
00389 a[i__4].r = 0., a[i__4].i = 0.;
00390 i__4 = n - 1 + i__;
00391 a[i__4].r = 0., a[i__4].i = 0.;
00392 i__4 = i__;
00393 a[i__4].r = 0., a[i__4].i = 0.;
00394
00395 }
00396 i__3 = n * 3 - 2;
00397 a[i__3].r = 0., a[i__3].i = 0.;
00398 i__3 = (n << 1) - 1;
00399 a[i__3].r = 0., a[i__3].i = 0.;
00400 }
00401 }
00402
00403 for (ifact = 1; ifact <= 2; ++ifact) {
00404 if (ifact == 1) {
00405 *(unsigned char *)fact = 'F';
00406 } else {
00407 *(unsigned char *)fact = 'N';
00408 }
00409
00410
00411
00412
00413 if (zerot) {
00414 if (ifact == 1) {
00415 goto L120;
00416 }
00417 rcondo = 0.;
00418 rcondi = 0.;
00419
00420 } else if (ifact == 1) {
00421 i__3 = n + (m << 1);
00422 zcopy_(&i__3, &a[1], &c__1, &af[1], &c__1);
00423
00424
00425
00426 anormo = zlangt_("1", &n, &a[1], &a[m + 1], &a[n + m + 1]);
00427 anormi = zlangt_("I", &n, &a[1], &a[m + 1], &a[n + m + 1]);
00428
00429
00430
00431 zgttrf_(&n, &af[1], &af[m + 1], &af[n + m + 1], &af[n + (
00432 m << 1) + 1], &iwork[1], &info);
00433
00434
00435
00436
00437 ainvnm = 0.;
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 i__5 = j;
00443 x[i__5].r = 0., x[i__5].i = 0.;
00444
00445 }
00446 i__4 = i__;
00447 x[i__4].r = 1., x[i__4].i = 0.;
00448 zgttrs_("No transpose", &n, &c__1, &af[1], &af[m + 1],
00449 &af[n + m + 1], &af[n + (m << 1) + 1], &
00450 iwork[1], &x[1], &lda, &info);
00451
00452 d__1 = ainvnm, d__2 = dzasum_(&n, &x[1], &c__1);
00453 ainvnm = max(d__1,d__2);
00454
00455 }
00456
00457
00458
00459 if (anormo <= 0. || ainvnm <= 0.) {
00460 rcondo = 1.;
00461 } else {
00462 rcondo = 1. / anormo / ainvnm;
00463 }
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_("Conjugate transpose", &n, &c__1, &af[1], &af[
00480 m + 1], &af[n + m + 1], &af[n + (m << 1) + 1],
00481 &iwork[1], &x[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 (anormi <= 0. || ainvnm <= 0.) {
00491 rcondi = 1.;
00492 } else {
00493 rcondi = 1. / anormi / ainvnm;
00494 }
00495 }
00496
00497 for (itran = 1; itran <= 3; ++itran) {
00498 *(unsigned char *)trans = *(unsigned char *)&transs[itran
00499 - 1];
00500 if (itran == 1) {
00501 rcondc = rcondo;
00502 } else {
00503 rcondc = rcondi;
00504 }
00505
00506
00507
00508 ix = 1;
00509 i__3 = *nrhs;
00510 for (j = 1; j <= i__3; ++j) {
00511 zlarnv_(&c__2, iseed, &n, &xact[ix]);
00512 ix += lda;
00513
00514 }
00515
00516
00517
00518 zlagtm_(trans, &n, nrhs, &c_b43, &a[1], &a[m + 1], &a[n +
00519 m + 1], &xact[1], &lda, &c_b44, &b[1], &lda);
00520
00521 if (ifact == 2 && itran == 1) {
00522
00523
00524
00525
00526
00527
00528 i__3 = n + (m << 1);
00529 zcopy_(&i__3, &a[1], &c__1, &af[1], &c__1);
00530 zlacpy_("Full", &n, nrhs, &b[1], &lda, &x[1], &lda);
00531
00532 s_copy(srnamc_1.srnamt, "ZGTSV ", (ftnlen)32, (ftnlen)
00533 6);
00534 zgtsv_(&n, nrhs, &af[1], &af[m + 1], &af[n + m + 1], &
00535 x[1], &lda, &info);
00536
00537
00538
00539 if (info != izero) {
00540 alaerh_(path, "ZGTSV ", &info, &izero, " ", &n, &
00541 n, &c__1, &c__1, nrhs, &imat, &nfail, &
00542 nerrs, nout);
00543 }
00544 nt = 1;
00545 if (izero == 0) {
00546
00547
00548
00549 zlacpy_("Full", &n, nrhs, &b[1], &lda, &work[1], &
00550 lda);
00551 zgtt02_(trans, &n, nrhs, &a[1], &a[m + 1], &a[n +
00552 m + 1], &x[1], &lda, &work[1], &lda, &
00553 rwork[1], &result[1]);
00554
00555
00556
00557 zget04_(&n, nrhs, &x[1], &lda, &xact[1], &lda, &
00558 rcondc, &result[2]);
00559 nt = 3;
00560 }
00561
00562
00563
00564
00565 i__3 = nt;
00566 for (k = 2; k <= i__3; ++k) {
00567 if (result[k - 1] >= *thresh) {
00568 if (nfail == 0 && nerrs == 0) {
00569 aladhd_(nout, path);
00570 }
00571 io___42.ciunit = *nout;
00572 s_wsfe(&io___42);
00573 do_fio(&c__1, "ZGTSV ", (ftnlen)6);
00574 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(
00575 integer));
00576 do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(
00577 integer));
00578 do_fio(&c__1, (char *)&k, (ftnlen)sizeof(
00579 integer));
00580 do_fio(&c__1, (char *)&result[k - 1], (ftnlen)
00581 sizeof(doublereal));
00582 e_wsfe();
00583 ++nfail;
00584 }
00585
00586 }
00587 nrun = nrun + nt - 1;
00588 }
00589
00590
00591
00592 if (ifact > 1) {
00593
00594
00595
00596 i__3 = n * 3 - 2;
00597 for (i__ = 1; i__ <= i__3; ++i__) {
00598 i__4 = i__;
00599 af[i__4].r = 0., af[i__4].i = 0.;
00600
00601 }
00602 }
00603 zlaset_("Full", &n, nrhs, &c_b65, &c_b65, &x[1], &lda);
00604
00605
00606
00607
00608 s_copy(srnamc_1.srnamt, "ZGTSVX", (ftnlen)32, (ftnlen)6);
00609 zgtsvx_(fact, trans, &n, nrhs, &a[1], &a[m + 1], &a[n + m
00610 + 1], &af[1], &af[m + 1], &af[n + m + 1], &af[n +
00611 (m << 1) + 1], &iwork[1], &b[1], &lda, &x[1], &
00612 lda, &rcond, &rwork[1], &rwork[*nrhs + 1], &work[
00613 1], &rwork[(*nrhs << 1) + 1], &info);
00614
00615
00616
00617 if (info != izero) {
00618
00619 i__6[0] = 1, a__1[0] = fact;
00620 i__6[1] = 1, a__1[1] = trans;
00621 s_cat(ch__1, a__1, i__6, &c__2, (ftnlen)2);
00622 alaerh_(path, "ZGTSVX", &info, &izero, ch__1, &n, &n,
00623 &c__1, &c__1, nrhs, &imat, &nfail, &nerrs,
00624 nout);
00625 }
00626
00627 if (ifact >= 2) {
00628
00629
00630
00631
00632 zgtt01_(&n, &a[1], &a[m + 1], &a[n + m + 1], &af[1], &
00633 af[m + 1], &af[n + m + 1], &af[n + (m << 1) +
00634 1], &iwork[1], &work[1], &lda, &rwork[1],
00635 result);
00636 k1 = 1;
00637 } else {
00638 k1 = 2;
00639 }
00640
00641 if (info == 0) {
00642 trfcon = FALSE_;
00643
00644
00645
00646 zlacpy_("Full", &n, nrhs, &b[1], &lda, &work[1], &lda);
00647 zgtt02_(trans, &n, nrhs, &a[1], &a[m + 1], &a[n + m +
00648 1], &x[1], &lda, &work[1], &lda, &rwork[1], &
00649 result[1]);
00650
00651
00652
00653 zget04_(&n, nrhs, &x[1], &lda, &xact[1], &lda, &
00654 rcondc, &result[2]);
00655
00656
00657
00658 zgtt05_(trans, &n, nrhs, &a[1], &a[m + 1], &a[n + m +
00659 1], &b[1], &lda, &x[1], &lda, &xact[1], &lda,
00660 &rwork[1], &rwork[*nrhs + 1], &result[3]);
00661 nt = 5;
00662 }
00663
00664
00665
00666
00667 i__3 = nt;
00668 for (k = k1; k <= i__3; ++k) {
00669 if (result[k - 1] >= *thresh) {
00670 if (nfail == 0 && nerrs == 0) {
00671 aladhd_(nout, path);
00672 }
00673 io___46.ciunit = *nout;
00674 s_wsfe(&io___46);
00675 do_fio(&c__1, "ZGTSVX", (ftnlen)6);
00676 do_fio(&c__1, fact, (ftnlen)1);
00677 do_fio(&c__1, trans, (ftnlen)1);
00678 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer))
00679 ;
00680 do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(
00681 integer));
00682 do_fio(&c__1, (char *)&k, (ftnlen)sizeof(integer))
00683 ;
00684 do_fio(&c__1, (char *)&result[k - 1], (ftnlen)
00685 sizeof(doublereal));
00686 e_wsfe();
00687 ++nfail;
00688 }
00689
00690 }
00691
00692
00693
00694 result[5] = dget06_(&rcond, &rcondc);
00695 if (result[5] >= *thresh) {
00696 if (nfail == 0 && nerrs == 0) {
00697 aladhd_(nout, path);
00698 }
00699 io___47.ciunit = *nout;
00700 s_wsfe(&io___47);
00701 do_fio(&c__1, "ZGTSVX", (ftnlen)6);
00702 do_fio(&c__1, fact, (ftnlen)1);
00703 do_fio(&c__1, trans, (ftnlen)1);
00704 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00705 do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(integer));
00706 do_fio(&c__1, (char *)&k, (ftnlen)sizeof(integer));
00707 do_fio(&c__1, (char *)&result[k - 1], (ftnlen)sizeof(
00708 doublereal));
00709 e_wsfe();
00710 ++nfail;
00711 }
00712 nrun = nrun + nt - k1 + 2;
00713
00714
00715 }
00716 L120:
00717 ;
00718 }
00719 L130:
00720 ;
00721 }
00722
00723 }
00724
00725
00726
00727 alasvm_(path, nout, &nfail, &nrun, &nerrs);
00728
00729 return 0;
00730
00731
00732
00733 }