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