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__1 = 1;
00034 static integer c__2 = 2;
00035 static integer c__0 = 0;
00036 static integer c_n1 = -1;
00037 static doublecomplex c_b23 = {0.,0.};
00038 static logical c_true = TRUE_;
00039 static integer c__8 = 8;
00040
00041 int zchkge_(logical *dotype, integer *nm, integer *mval,
00042 integer *nn, integer *nval, integer *nnb, integer *nbval, integer *
00043 nns, integer *nsval, doublereal *thresh, logical *tsterr, integer *
00044 nmax, doublecomplex *a, doublecomplex *afac, doublecomplex *ainv,
00045 doublecomplex *b, doublecomplex *x, doublecomplex *xact,
00046 doublecomplex *work, doublereal *rwork, integer *iwork, integer *nout)
00047 {
00048
00049
00050 static integer iseedy[4] = { 1988,1989,1990,1991 };
00051 static char transs[1*3] = "N" "T" "C";
00052
00053
00054 static char fmt_9999[] = "(\002 M = \002,i5,\002, N =\002,i5,\002, NB "
00055 "=\002,i4,\002, type \002,i2,\002, test(\002,i2,\002) =\002,g12.5)"
00056 ;
00057 static char fmt_9998[] = "(\002 TRANS='\002,a1,\002', N =\002,i5,\002, N"
00058 "RHS=\002,i3,\002, type \002,i2,\002, test(\002,i2,\002) =\002,g1"
00059 "2.5)";
00060 static char fmt_9997[] = "(\002 NORM ='\002,a1,\002', N =\002,i5,\002"
00061 ",\002,10x,\002 type \002,i2,\002, test(\002,i2,\002) =\002,g12.5)"
00062 ;
00063
00064
00065 integer i__1, i__2, i__3, i__4, i__5;
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__, k, m, n, nb, im, in, kl, ku, nt, lda, inb, ioff, mode, imat,
00073 info;
00074 char path[3], dist[1];
00075 integer irhs, nrhs;
00076 char norm[1], type__[1];
00077 integer nrun;
00078 extern int alahd_(integer *, char *);
00079 integer nfail, iseed[4];
00080 extern doublereal dget06_(doublereal *, doublereal *);
00081 doublereal rcond;
00082 integer nimat;
00083 extern int zget01_(integer *, integer *, doublecomplex *,
00084 integer *, doublecomplex *, integer *, integer *, doublereal *,
00085 doublereal *), zget02_(char *, integer *, integer *, integer *,
00086 doublecomplex *, integer *, doublecomplex *, integer *,
00087 doublecomplex *, integer *, doublereal *, doublereal *);
00088 doublereal anorm;
00089 integer itran;
00090 extern int zget03_(integer *, doublecomplex *, integer *,
00091 doublecomplex *, integer *, doublecomplex *, integer *,
00092 doublereal *, doublereal *, doublereal *), zget04_(integer *,
00093 integer *, doublecomplex *, integer *, doublecomplex *, integer *,
00094 doublereal *, doublereal *), zget07_(char *, integer *, integer *
00095 , doublecomplex *, integer *, doublecomplex *, integer *,
00096 doublecomplex *, integer *, doublecomplex *, integer *,
00097 doublereal *, logical *, doublereal *, doublereal *);
00098 char trans[1];
00099 integer izero, nerrs;
00100 doublereal dummy;
00101 integer lwork;
00102 logical zerot;
00103 char xtype[1];
00104 extern int zlatb4_(char *, integer *, integer *, integer
00105 *, char *, integer *, integer *, doublereal *, integer *,
00106 doublereal *, char *), alaerh_(char *,
00107 char *, integer *, integer *, char *, integer *, integer *,
00108 integer *, integer *, integer *, integer *, integer *, integer *,
00109 integer *);
00110 doublereal rcondc, rcondi;
00111 extern doublereal zlange_(char *, integer *, integer *, doublecomplex *,
00112 integer *, doublereal *);
00113 extern int alasum_(char *, integer *, integer *, integer
00114 *, integer *);
00115 doublereal cndnum, anormi, rcondo;
00116 extern int zgecon_(char *, integer *, doublecomplex *,
00117 integer *, doublereal *, doublereal *, doublecomplex *,
00118 doublereal *, integer *);
00119 doublereal ainvnm;
00120 logical trfcon;
00121 doublereal anormo;
00122 extern int xlaenv_(integer *, integer *), zerrge_(char *,
00123 integer *), zgerfs_(char *, integer *, integer *,
00124 doublecomplex *, integer *, doublecomplex *, integer *, integer *,
00125 doublecomplex *, integer *, doublecomplex *, integer *,
00126 doublereal *, doublereal *, doublecomplex *, doublereal *,
00127 integer *), zgetrf_(integer *, integer *, doublecomplex *,
00128 integer *, integer *, integer *), zlacpy_(char *, integer *,
00129 integer *, doublecomplex *, integer *, doublecomplex *, integer *), zlarhs_(char *, char *, char *, char *, integer *,
00130 integer *, integer *, integer *, integer *, doublecomplex *,
00131 integer *, doublecomplex *, integer *, doublecomplex *, integer *,
00132 integer *, integer *), zgetri_(
00133 integer *, doublecomplex *, integer *, integer *, doublecomplex *,
00134 integer *, integer *), zlaset_(char *, integer *, integer *,
00135 doublecomplex *, doublecomplex *, doublecomplex *, integer *), zlatms_(integer *, integer *, char *, integer *, char *,
00136 doublereal *, integer *, doublereal *, doublereal *, integer *,
00137 integer *, char *, doublecomplex *, integer *, doublecomplex *,
00138 integer *);
00139 doublereal result[8];
00140 extern int zgetrs_(char *, integer *, integer *,
00141 doublecomplex *, integer *, integer *, doublecomplex *, integer *,
00142 integer *);
00143
00144
00145 static cilist io___41 = { 0, 0, 0, fmt_9999, 0 };
00146 static cilist io___46 = { 0, 0, 0, fmt_9998, 0 };
00147 static cilist io___50 = { 0, 0, 0, fmt_9997, 0 };
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
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257 --iwork;
00258 --rwork;
00259 --work;
00260 --xact;
00261 --x;
00262 --b;
00263 --ainv;
00264 --afac;
00265 --a;
00266 --nsval;
00267 --nbval;
00268 --nval;
00269 --mval;
00270 --dotype;
00271
00272
00273
00274
00275
00276
00277
00278 s_copy(path, "Zomplex precision", (ftnlen)1, (ftnlen)17);
00279 s_copy(path + 1, "GE", (ftnlen)2, (ftnlen)2);
00280 nrun = 0;
00281 nfail = 0;
00282 nerrs = 0;
00283 for (i__ = 1; i__ <= 4; ++i__) {
00284 iseed[i__ - 1] = iseedy[i__ - 1];
00285
00286 }
00287
00288
00289
00290 xlaenv_(&c__1, &c__1);
00291 if (*tsterr) {
00292 zerrge_(path, nout);
00293 }
00294 infoc_1.infot = 0;
00295 xlaenv_(&c__2, &c__2);
00296
00297
00298
00299 i__1 = *nm;
00300 for (im = 1; im <= i__1; ++im) {
00301 m = mval[im];
00302 lda = max(1,m);
00303
00304
00305
00306 i__2 = *nn;
00307 for (in = 1; in <= i__2; ++in) {
00308 n = nval[in];
00309 *(unsigned char *)xtype = 'N';
00310 nimat = 11;
00311 if (m <= 0 || n <= 0) {
00312 nimat = 1;
00313 }
00314
00315 i__3 = nimat;
00316 for (imat = 1; imat <= i__3; ++imat) {
00317
00318
00319
00320 if (! dotype[imat]) {
00321 goto L100;
00322 }
00323
00324
00325
00326 zerot = imat >= 5 && imat <= 7;
00327 if (zerot && n < imat - 4) {
00328 goto L100;
00329 }
00330
00331
00332
00333
00334 zlatb4_(path, &imat, &m, &n, type__, &kl, &ku, &anorm, &mode,
00335 &cndnum, dist);
00336
00337 s_copy(srnamc_1.srnamt, "ZLATMS", (ftnlen)32, (ftnlen)6);
00338 zlatms_(&m, &n, dist, iseed, type__, &rwork[1], &mode, &
00339 cndnum, &anorm, &kl, &ku, "No packing", &a[1], &lda, &
00340 work[1], &info);
00341
00342
00343
00344 if (info != 0) {
00345 alaerh_(path, "ZLATMS", &info, &c__0, " ", &m, &n, &c_n1,
00346 &c_n1, &c_n1, &imat, &nfail, &nerrs, nout);
00347 goto L100;
00348 }
00349
00350
00351
00352
00353 if (zerot) {
00354 if (imat == 5) {
00355 izero = 1;
00356 } else if (imat == 6) {
00357 izero = min(m,n);
00358 } else {
00359 izero = min(m,n) / 2 + 1;
00360 }
00361 ioff = (izero - 1) * lda;
00362 if (imat < 7) {
00363 i__4 = m;
00364 for (i__ = 1; i__ <= i__4; ++i__) {
00365 i__5 = ioff + i__;
00366 a[i__5].r = 0., a[i__5].i = 0.;
00367
00368 }
00369 } else {
00370 i__4 = n - izero + 1;
00371 zlaset_("Full", &m, &i__4, &c_b23, &c_b23, &a[ioff +
00372 1], &lda);
00373 }
00374 } else {
00375 izero = 0;
00376 }
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386 i__4 = *nnb;
00387 for (inb = 1; inb <= i__4; ++inb) {
00388 nb = nbval[inb];
00389 xlaenv_(&c__1, &nb);
00390
00391
00392
00393 zlacpy_("Full", &m, &n, &a[1], &lda, &afac[1], &lda);
00394 s_copy(srnamc_1.srnamt, "ZGETRF", (ftnlen)32, (ftnlen)6);
00395 zgetrf_(&m, &n, &afac[1], &lda, &iwork[1], &info);
00396
00397
00398
00399 if (info != izero) {
00400 alaerh_(path, "ZGETRF", &info, &izero, " ", &m, &n, &
00401 c_n1, &c_n1, &nb, &imat, &nfail, &nerrs, nout);
00402 }
00403 trfcon = FALSE_;
00404
00405
00406
00407
00408 zlacpy_("Full", &m, &n, &afac[1], &lda, &ainv[1], &lda);
00409 zget01_(&m, &n, &a[1], &lda, &ainv[1], &lda, &iwork[1], &
00410 rwork[1], result);
00411 nt = 1;
00412
00413
00414
00415
00416
00417 if (m == n && info == 0) {
00418 zlacpy_("Full", &n, &n, &afac[1], &lda, &ainv[1], &
00419 lda);
00420 s_copy(srnamc_1.srnamt, "ZGETRI", (ftnlen)32, (ftnlen)
00421 6);
00422 nrhs = nsval[1];
00423 lwork = *nmax * max(3,nrhs);
00424 zgetri_(&n, &ainv[1], &lda, &iwork[1], &work[1], &
00425 lwork, &info);
00426
00427
00428
00429 if (info != 0) {
00430 alaerh_(path, "ZGETRI", &info, &c__0, " ", &n, &n,
00431 &c_n1, &c_n1, &nb, &imat, &nfail, &nerrs,
00432 nout);
00433 }
00434
00435
00436
00437
00438
00439 zget03_(&n, &a[1], &lda, &ainv[1], &lda, &work[1], &
00440 lda, &rwork[1], &rcondo, &result[1]);
00441 anormo = zlange_("O", &m, &n, &a[1], &lda, &rwork[1]);
00442
00443
00444
00445 anormi = zlange_("I", &m, &n, &a[1], &lda, &rwork[1]);
00446 ainvnm = zlange_("I", &n, &n, &ainv[1], &lda, &rwork[
00447 1]);
00448 if (anormi <= 0. || ainvnm <= 0.) {
00449 rcondi = 1.;
00450 } else {
00451 rcondi = 1. / anormi / ainvnm;
00452 }
00453 nt = 2;
00454 } else {
00455
00456
00457
00458 trfcon = TRUE_;
00459 anormo = zlange_("O", &m, &n, &a[1], &lda, &rwork[1]);
00460 anormi = zlange_("I", &m, &n, &a[1], &lda, &rwork[1]);
00461 rcondo = 0.;
00462 rcondi = 0.;
00463 }
00464
00465
00466
00467
00468 i__5 = nt;
00469 for (k = 1; k <= i__5; ++k) {
00470 if (result[k - 1] >= *thresh) {
00471 if (nfail == 0 && nerrs == 0) {
00472 alahd_(nout, path);
00473 }
00474 io___41.ciunit = *nout;
00475 s_wsfe(&io___41);
00476 do_fio(&c__1, (char *)&m, (ftnlen)sizeof(integer))
00477 ;
00478 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer))
00479 ;
00480 do_fio(&c__1, (char *)&nb, (ftnlen)sizeof(integer)
00481 );
00482 do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(
00483 integer));
00484 do_fio(&c__1, (char *)&k, (ftnlen)sizeof(integer))
00485 ;
00486 do_fio(&c__1, (char *)&result[k - 1], (ftnlen)
00487 sizeof(doublereal));
00488 e_wsfe();
00489 ++nfail;
00490 }
00491
00492 }
00493 nrun += nt;
00494
00495
00496
00497
00498
00499 if (inb > 1 || m != n) {
00500 goto L90;
00501 }
00502 if (trfcon) {
00503 goto L70;
00504 }
00505
00506 i__5 = *nns;
00507 for (irhs = 1; irhs <= i__5; ++irhs) {
00508 nrhs = nsval[irhs];
00509 *(unsigned char *)xtype = 'N';
00510
00511 for (itran = 1; itran <= 3; ++itran) {
00512 *(unsigned char *)trans = *(unsigned char *)&
00513 transs[itran - 1];
00514 if (itran == 1) {
00515 rcondc = rcondo;
00516 } else {
00517 rcondc = rcondi;
00518 }
00519
00520
00521
00522
00523 s_copy(srnamc_1.srnamt, "ZLARHS", (ftnlen)32, (
00524 ftnlen)6);
00525 zlarhs_(path, xtype, " ", trans, &n, &n, &kl, &ku,
00526 &nrhs, &a[1], &lda, &xact[1], &lda, &b[1]
00527 , &lda, iseed, &info);
00528 *(unsigned char *)xtype = 'C';
00529
00530 zlacpy_("Full", &n, &nrhs, &b[1], &lda, &x[1], &
00531 lda);
00532 s_copy(srnamc_1.srnamt, "ZGETRS", (ftnlen)32, (
00533 ftnlen)6);
00534 zgetrs_(trans, &n, &nrhs, &afac[1], &lda, &iwork[
00535 1], &x[1], &lda, &info);
00536
00537
00538
00539 if (info != 0) {
00540 alaerh_(path, "ZGETRS", &info, &c__0, trans, &
00541 n, &n, &c_n1, &c_n1, &nrhs, &imat, &
00542 nfail, &nerrs, nout);
00543 }
00544
00545 zlacpy_("Full", &n, &nrhs, &b[1], &lda, &work[1],
00546 &lda);
00547 zget02_(trans, &n, &n, &nrhs, &a[1], &lda, &x[1],
00548 &lda, &work[1], &lda, &rwork[1], &result[
00549 2]);
00550
00551
00552
00553
00554 zget04_(&n, &nrhs, &x[1], &lda, &xact[1], &lda, &
00555 rcondc, &result[3]);
00556
00557
00558
00559
00560
00561 s_copy(srnamc_1.srnamt, "ZGERFS", (ftnlen)32, (
00562 ftnlen)6);
00563 zgerfs_(trans, &n, &nrhs, &a[1], &lda, &afac[1], &
00564 lda, &iwork[1], &b[1], &lda, &x[1], &lda,
00565 &rwork[1], &rwork[nrhs + 1], &work[1], &
00566 rwork[(nrhs << 1) + 1], &info);
00567
00568
00569
00570 if (info != 0) {
00571 alaerh_(path, "ZGERFS", &info, &c__0, trans, &
00572 n, &n, &c_n1, &c_n1, &nrhs, &imat, &
00573 nfail, &nerrs, nout);
00574 }
00575
00576 zget04_(&n, &nrhs, &x[1], &lda, &xact[1], &lda, &
00577 rcondc, &result[4]);
00578 zget07_(trans, &n, &nrhs, &a[1], &lda, &b[1], &
00579 lda, &x[1], &lda, &xact[1], &lda, &rwork[
00580 1], &c_true, &rwork[nrhs + 1], &result[5]);
00581
00582
00583
00584
00585 for (k = 3; k <= 7; ++k) {
00586 if (result[k - 1] >= *thresh) {
00587 if (nfail == 0 && nerrs == 0) {
00588 alahd_(nout, path);
00589 }
00590 io___46.ciunit = *nout;
00591 s_wsfe(&io___46);
00592 do_fio(&c__1, trans, (ftnlen)1);
00593 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(
00594 integer));
00595 do_fio(&c__1, (char *)&nrhs, (ftnlen)
00596 sizeof(integer));
00597 do_fio(&c__1, (char *)&imat, (ftnlen)
00598 sizeof(integer));
00599 do_fio(&c__1, (char *)&k, (ftnlen)sizeof(
00600 integer));
00601 do_fio(&c__1, (char *)&result[k - 1], (
00602 ftnlen)sizeof(doublereal));
00603 e_wsfe();
00604 ++nfail;
00605 }
00606
00607 }
00608 nrun += 5;
00609
00610 }
00611
00612 }
00613
00614
00615
00616
00617 L70:
00618 for (itran = 1; itran <= 2; ++itran) {
00619 if (itran == 1) {
00620 anorm = anormo;
00621 rcondc = rcondo;
00622 *(unsigned char *)norm = 'O';
00623 } else {
00624 anorm = anormi;
00625 rcondc = rcondi;
00626 *(unsigned char *)norm = 'I';
00627 }
00628 s_copy(srnamc_1.srnamt, "ZGECON", (ftnlen)32, (ftnlen)
00629 6);
00630 zgecon_(norm, &n, &afac[1], &lda, &anorm, &rcond, &
00631 work[1], &rwork[1], &info);
00632
00633
00634
00635 if (info != 0) {
00636 alaerh_(path, "ZGECON", &info, &c__0, norm, &n, &
00637 n, &c_n1, &c_n1, &c_n1, &imat, &nfail, &
00638 nerrs, nout);
00639 }
00640
00641
00642
00643 dummy = rcond;
00644
00645 result[7] = dget06_(&rcond, &rcondc);
00646
00647
00648
00649
00650 if (result[7] >= *thresh) {
00651 if (nfail == 0 && nerrs == 0) {
00652 alahd_(nout, path);
00653 }
00654 io___50.ciunit = *nout;
00655 s_wsfe(&io___50);
00656 do_fio(&c__1, norm, (ftnlen)1);
00657 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer))
00658 ;
00659 do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(
00660 integer));
00661 do_fio(&c__1, (char *)&c__8, (ftnlen)sizeof(
00662 integer));
00663 do_fio(&c__1, (char *)&result[7], (ftnlen)sizeof(
00664 doublereal));
00665 e_wsfe();
00666 ++nfail;
00667 }
00668 ++nrun;
00669
00670 }
00671 L90:
00672 ;
00673 }
00674 L100:
00675 ;
00676 }
00677
00678
00679 }
00680
00681 }
00682
00683
00684
00685 alasum_(path, nout, &nfail, &nrun, &nerrs);
00686
00687 return 0;
00688
00689
00690
00691 }