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