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 char srnamt[32];
00020 } srnamc_;
00021
00022 #define srnamc_1 srnamc_
00023
00024
00025
00026 static integer c__0 = 0;
00027 static integer c_n1 = -1;
00028 static integer c__1 = 1;
00029
00030 int sdrvrfp_(integer *nout, integer *nn, integer *nval,
00031 integer *nns, integer *nsval, integer *nnt, integer *ntval, real *
00032 thresh, real *a, real *asav, real *afac, real *ainv, real *b, real *
00033 bsav, real *xact, real *x, real *arf, real *arfinv, real *
00034 s_work_slatms__, real *s_work_spot01__, real *s_temp_spot02__, real *
00035 s_temp_spot03__, real *s_work_slansy__, real *s_work_spot02__, real *
00036 s_work_spot03__)
00037 {
00038
00039
00040 static integer iseedy[4] = { 1988,1989,1990,1991 };
00041 static char uplos[1*2] = "U" "L";
00042 static char forms[1*2] = "N" "T";
00043
00044
00045 static char fmt_9999[] = "(1x,a6,\002, UPLO='\002,a1,\002', N =\002,i5"
00046 ",\002, type \002,i1,\002, test(\002,i1,\002)=\002,g12.5)";
00047
00048
00049 integer i__1, i__2, i__3, i__4, i__5, i__6, i__7;
00050
00051
00052 int s_copy(char *, char *, ftnlen, ftnlen);
00053 integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
00054
00055
00056 integer i__, k, n, kl, ku, nt, lda, ldb, iin, iis, iit, ioff, mode, info,
00057 imat;
00058 char dist[1];
00059 integer nrhs;
00060 char uplo[1];
00061 integer nrun, nfail, iseed[4];
00062 char cform[1];
00063 extern int sget04_(integer *, integer *, real *, integer
00064 *, real *, integer *, real *, real *);
00065 integer iform;
00066 real anorm;
00067 char ctype[1];
00068 extern int spot01_(char *, integer *, real *, integer *,
00069 real *, integer *, real *, real *);
00070 integer iuplo, nerrs, izero;
00071 extern int spot02_(char *, integer *, integer *, real *,
00072 integer *, real *, integer *, real *, integer *, real *, real *), spot03_(char *, integer *, real *, integer *, real *,
00073 integer *, real *, integer *, real *, real *, real *);
00074 logical zerot;
00075 extern int slatb4_(char *, integer *, integer *, integer
00076 *, char *, integer *, integer *, real *, integer *, real *, char *
00077 ), aladhd_(integer *, char *),
00078 alaerh_(char *, char *, integer *, integer *, char *, integer *,
00079 integer *, integer *, integer *, integer *, integer *, integer *,
00080 integer *, integer *);
00081 real rcondc;
00082 extern int alasvm_(char *, integer *, integer *, integer
00083 *, integer *);
00084 real cndnum, ainvnm;
00085 extern int slacpy_(char *, integer *, integer *, real *,
00086 integer *, real *, integer *), slarhs_(char *, char *,
00087 char *, char *, integer *, integer *, integer *, integer *,
00088 integer *, real *, integer *, real *, integer *, real *, integer *
00089 , integer *, integer *), slatms_(
00090 integer *, integer *, char *, integer *, char *, real *, integer *
00091 , real *, real *, integer *, integer *, char *, real *, integer *,
00092 real *, integer *), spftrf_(char *, char
00093 *, integer *, real *, integer *), spftri_(char *,
00094 char *, integer *, real *, integer *);
00095 extern doublereal slansy_(char *, char *, integer *, real *, integer *,
00096 real *);
00097 extern int spotrf_(char *, integer *, real *, integer *,
00098 integer *);
00099 real result[4];
00100 extern int spftrs_(char *, char *, integer *, integer *,
00101 real *, real *, integer *, integer *), spotri_(
00102 char *, integer *, real *, integer *, integer *), stfttr_(
00103 char *, char *, integer *, real *, real *, integer *, integer *), strttf_(char *, char *, integer *, real *,
00104 integer *, real *, integer *);
00105
00106
00107 static cilist io___37 = { 0, 0, 0, fmt_9999, 0 };
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
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 --nval;
00240 --nsval;
00241 --ntval;
00242 --a;
00243 --asav;
00244 --afac;
00245 --ainv;
00246 --b;
00247 --bsav;
00248 --xact;
00249 --x;
00250 --arf;
00251 --arfinv;
00252 --s_work_slatms__;
00253 --s_work_spot01__;
00254 --s_temp_spot02__;
00255 --s_temp_spot03__;
00256 --s_work_slansy__;
00257 --s_work_spot02__;
00258 --s_work_spot03__;
00259
00260
00261
00262
00263
00264
00265
00266 nrun = 0;
00267 nfail = 0;
00268 nerrs = 0;
00269 for (i__ = 1; i__ <= 4; ++i__) {
00270 iseed[i__ - 1] = iseedy[i__ - 1];
00271
00272 }
00273
00274 i__1 = *nn;
00275 for (iin = 1; iin <= i__1; ++iin) {
00276
00277 n = nval[iin];
00278 lda = max(n,1);
00279 ldb = max(n,1);
00280
00281 i__2 = *nns;
00282 for (iis = 1; iis <= i__2; ++iis) {
00283
00284 nrhs = nsval[iis];
00285
00286 i__3 = *nnt;
00287 for (iit = 1; iit <= i__3; ++iit) {
00288
00289 imat = ntval[iit];
00290
00291
00292
00293 if (n == 0 && iit > 1) {
00294 goto L120;
00295 }
00296
00297
00298
00299 if (imat == 4 && n <= 1) {
00300 goto L120;
00301 }
00302 if (imat == 5 && n <= 2) {
00303 goto L120;
00304 }
00305
00306
00307
00308 for (iuplo = 1; iuplo <= 2; ++iuplo) {
00309 *(unsigned char *)uplo = *(unsigned char *)&uplos[iuplo -
00310 1];
00311
00312
00313
00314 for (iform = 1; iform <= 2; ++iform) {
00315 *(unsigned char *)cform = *(unsigned char *)&forms[
00316 iform - 1];
00317
00318
00319
00320
00321 slatb4_("SPO", &imat, &n, &n, ctype, &kl, &ku, &anorm,
00322 &mode, &cndnum, dist);
00323
00324 s_copy(srnamc_1.srnamt, "SLATMS", (ftnlen)32, (ftnlen)
00325 6);
00326 slatms_(&n, &n, dist, iseed, ctype, &s_work_slatms__[
00327 1], &mode, &cndnum, &anorm, &kl, &ku, uplo, &
00328 a[1], &lda, &s_work_slatms__[1], &info);
00329
00330
00331
00332 if (info != 0) {
00333 alaerh_("SPF", "SLATMS", &info, &c__0, uplo, &n, &
00334 n, &c_n1, &c_n1, &c_n1, &iit, &nfail, &
00335 nerrs, nout);
00336 goto L100;
00337 }
00338
00339
00340
00341
00342 zerot = imat >= 3 && imat <= 5;
00343 if (zerot) {
00344 if (iit == 3) {
00345 izero = 1;
00346 } else if (iit == 4) {
00347 izero = n;
00348 } else {
00349 izero = n / 2 + 1;
00350 }
00351 ioff = (izero - 1) * lda;
00352
00353
00354
00355 if (iuplo == 1) {
00356 i__4 = izero - 1;
00357 for (i__ = 1; i__ <= i__4; ++i__) {
00358 a[ioff + i__] = 0.f;
00359
00360 }
00361 ioff += izero;
00362 i__4 = n;
00363 for (i__ = izero; i__ <= i__4; ++i__) {
00364 a[ioff] = 0.f;
00365 ioff += lda;
00366
00367 }
00368 } else {
00369 ioff = izero;
00370 i__4 = izero - 1;
00371 for (i__ = 1; i__ <= i__4; ++i__) {
00372 a[ioff] = 0.f;
00373 ioff += lda;
00374
00375 }
00376 ioff -= izero;
00377 i__4 = n;
00378 for (i__ = izero; i__ <= i__4; ++i__) {
00379 a[ioff + i__] = 0.f;
00380
00381 }
00382 }
00383 } else {
00384 izero = 0;
00385 }
00386
00387
00388
00389 slacpy_(uplo, &n, &n, &a[1], &lda, &asav[1], &lda);
00390
00391
00392
00393 if (zerot) {
00394 rcondc = 0.f;
00395 } else {
00396
00397
00398
00399 anorm = slansy_("1", uplo, &n, &a[1], &lda, &
00400 s_work_slansy__[1]);
00401
00402
00403
00404 spotrf_(uplo, &n, &a[1], &lda, &info);
00405
00406
00407
00408 spotri_(uplo, &n, &a[1], &lda, &info);
00409
00410
00411
00412 ainvnm = slansy_("1", uplo, &n, &a[1], &lda, &
00413 s_work_slansy__[1]);
00414 rcondc = 1.f / anorm / ainvnm;
00415
00416
00417
00418 slacpy_(uplo, &n, &n, &asav[1], &lda, &a[1], &lda);
00419
00420 }
00421
00422
00423
00424 s_copy(srnamc_1.srnamt, "SLARHS", (ftnlen)32, (ftnlen)
00425 6);
00426 slarhs_("SPO", "N", uplo, " ", &n, &n, &kl, &ku, &
00427 nrhs, &a[1], &lda, &xact[1], &lda, &b[1], &
00428 lda, iseed, &info);
00429 slacpy_("Full", &n, &nrhs, &b[1], &lda, &bsav[1], &
00430 lda);
00431
00432
00433
00434
00435 slacpy_(uplo, &n, &n, &a[1], &lda, &afac[1], &lda);
00436 slacpy_("Full", &n, &nrhs, &b[1], &ldb, &x[1], &ldb);
00437
00438 s_copy(srnamc_1.srnamt, "STRTTF", (ftnlen)32, (ftnlen)
00439 6);
00440 strttf_(cform, uplo, &n, &afac[1], &lda, &arf[1], &
00441 info);
00442 s_copy(srnamc_1.srnamt, "SPFTRF", (ftnlen)32, (ftnlen)
00443 6);
00444 spftrf_(cform, uplo, &n, &arf[1], &info);
00445
00446
00447
00448 if (info != izero) {
00449
00450
00451
00452
00453
00454 alaerh_("SPF", "SPFSV ", &info, &izero, uplo, &n,
00455 &n, &c_n1, &c_n1, &nrhs, &iit, &nfail, &
00456 nerrs, nout);
00457 goto L100;
00458 }
00459
00460
00461
00462 if (info != 0) {
00463 goto L100;
00464 }
00465
00466 s_copy(srnamc_1.srnamt, "SPFTRS", (ftnlen)32, (ftnlen)
00467 6);
00468 spftrs_(cform, uplo, &n, &nrhs, &arf[1], &x[1], &ldb,
00469 &info);
00470
00471 s_copy(srnamc_1.srnamt, "STFTTR", (ftnlen)32, (ftnlen)
00472 6);
00473 stfttr_(cform, uplo, &n, &arf[1], &afac[1], &lda, &
00474 info);
00475
00476
00477
00478
00479 slacpy_(uplo, &n, &n, &afac[1], &lda, &asav[1], &lda);
00480 spot01_(uplo, &n, &a[1], &lda, &afac[1], &lda, &
00481 s_work_spot01__[1], result);
00482 slacpy_(uplo, &n, &n, &asav[1], &lda, &afac[1], &lda);
00483
00484
00485
00486 if (n % 2 == 0) {
00487 i__4 = n + 1;
00488 i__5 = n / 2;
00489 i__6 = n + 1;
00490 i__7 = n + 1;
00491 slacpy_("A", &i__4, &i__5, &arf[1], &i__6, &
00492 arfinv[1], &i__7);
00493 } else {
00494 i__4 = (n + 1) / 2;
00495 slacpy_("A", &n, &i__4, &arf[1], &n, &arfinv[1], &
00496 n);
00497 }
00498
00499 s_copy(srnamc_1.srnamt, "SPFTRI", (ftnlen)32, (ftnlen)
00500 6);
00501 spftri_(cform, uplo, &n, &arfinv[1], &info);
00502
00503 s_copy(srnamc_1.srnamt, "STFTTR", (ftnlen)32, (ftnlen)
00504 6);
00505 stfttr_(cform, uplo, &n, &arfinv[1], &ainv[1], &lda, &
00506 info);
00507
00508
00509
00510 if (info != 0) {
00511 alaerh_("SPO", "SPFTRI", &info, &c__0, uplo, &n, &
00512 n, &c_n1, &c_n1, &c_n1, &imat, &nfail, &
00513 nerrs, nout);
00514 }
00515
00516 spot03_(uplo, &n, &a[1], &lda, &ainv[1], &lda, &
00517 s_temp_spot03__[1], &lda, &s_work_spot03__[1],
00518 &rcondc, &result[1]);
00519
00520
00521
00522 slacpy_("Full", &n, &nrhs, &b[1], &lda, &
00523 s_temp_spot02__[1], &lda);
00524 spot02_(uplo, &n, &nrhs, &a[1], &lda, &x[1], &lda, &
00525 s_temp_spot02__[1], &lda, &s_work_spot02__[1],
00526 &result[2]);
00527
00528
00529 sget04_(&n, &nrhs, &x[1], &lda, &xact[1], &lda, &
00530 rcondc, &result[3]);
00531 nt = 4;
00532
00533
00534
00535
00536 i__4 = nt;
00537 for (k = 1; k <= i__4; ++k) {
00538 if (result[k - 1] >= *thresh) {
00539 if (nfail == 0 && nerrs == 0) {
00540 aladhd_(nout, "SPF");
00541 }
00542 io___37.ciunit = *nout;
00543 s_wsfe(&io___37);
00544 do_fio(&c__1, "SPFSV ", (ftnlen)6);
00545 do_fio(&c__1, uplo, (ftnlen)1);
00546 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(
00547 integer));
00548 do_fio(&c__1, (char *)&iit, (ftnlen)sizeof(
00549 integer));
00550 do_fio(&c__1, (char *)&k, (ftnlen)sizeof(
00551 integer));
00552 do_fio(&c__1, (char *)&result[k - 1], (ftnlen)
00553 sizeof(real));
00554 e_wsfe();
00555 ++nfail;
00556 }
00557
00558 }
00559 nrun += nt;
00560 L100:
00561 ;
00562 }
00563
00564 }
00565 L120:
00566 ;
00567 }
00568
00569 }
00570
00571 }
00572
00573
00574
00575 alasvm_("SPF", nout, &nfail, &nrun, &nerrs);
00576
00577
00578 return 0;
00579
00580
00581
00582 }