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