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