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__0 = 0;
00034 static integer c_n1 = -1;
00035 static integer c__1 = 1;
00036
00037 int zdrvac_(logical *dotype, integer *nm, integer *mval,
00038 integer *nns, integer *nsval, doublereal *thresh, integer *nmax,
00039 doublecomplex *a, doublecomplex *afac, doublecomplex *b,
00040 doublecomplex *x, doublecomplex *work, doublereal *rwork, complex *
00041 swork, integer *nout)
00042 {
00043
00044
00045 static integer iseedy[4] = { 1988,1989,1990,1991 };
00046 static char uplos[1*2] = "U" "L";
00047
00048
00049 static char fmt_9988[] = "(\002 *** \002,a6,\002 returned with INFO ="
00050 "\002,i5,\002 instead of \002,i5,/\002 ==> N =\002,i5,\002, type"
00051 " \002,i2)";
00052 static char fmt_9975[] = "(\002 *** Error code from \002,a6,\002=\002,"
00053 "i5,\002 for M=\002,i5,\002, type \002,i2)";
00054 static char fmt_8999[] = "(/1x,a3,\002: positive definite dense matri"
00055 "ces\002)";
00056 static char fmt_8979[] = "(4x,\0021. Diagonal\002,24x,\0027. Last n/2 co"
00057 "lumns zero\002,/4x,\0022. Upper triangular\002,16x,\0028. Random"
00058 ", CNDNUM = sqrt(0.1/EPS)\002,/4x,\0023. Lower triangular\002,16x,"
00059 "\0029. Random, CNDNUM = 0.1/EPS\002,/4x,\0024. Random, CNDNUM = 2"
00060 "\002,13x,\00210. Scaled near underflow\002,/4x,\0025. First colu"
00061 "mn zero\002,14x,\00211. Scaled near overflow\002,/4x,\0026. Last"
00062 " column zero\002)";
00063 static char fmt_8960[] = "(3x,i2,\002: norm_1( B - A * X ) / \002,\002("
00064 " norm_1(A) * norm_1(X) * EPS * SQRT(N) ) > 1 if ITERREF\002,/4x"
00065 ",\002or norm_1( B - A * X ) / \002,\002( norm_1(A) * norm_1(X) "
00066 "* EPS ) > THRES if ZPOTRF\002)";
00067 static char fmt_9998[] = "(\002 UPLO='\002,a1,\002', N =\002,i5,\002, NR"
00068 "HS=\002,i3,\002, type \002,i2,\002, test(\002,i2,\002) =\002,g12"
00069 ".5)";
00070 static char fmt_9996[] = "(1x,a6,\002: \002,i6,\002 out of \002,i6,\002 "
00071 "tests failed to pass the threshold\002)";
00072 static char fmt_9995[] = "(/1x,\002All tests for \002,a6,\002 routines p"
00073 "assed the threshold (\002,i6,\002 tests run)\002)";
00074 static char fmt_9994[] = "(6x,i6,\002 error messages recorded\002)";
00075
00076
00077 integer i__1, i__2, i__3, i__4;
00078 cilist ci__1;
00079
00080
00081 int s_copy(char *, char *, ftnlen, ftnlen);
00082 integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
00083 double sqrt(doublereal);
00084
00085
00086 integer i__, n, im, kl, ku, lda, ioff, mode, kase, imat, info;
00087 char path[3], dist[1];
00088 integer irhs, iter, nrhs;
00089 char uplo[1], type__[1];
00090 integer nrun;
00091 extern int alahd_(integer *, char *);
00092 integer nfail, iseed[4], nimat;
00093 doublereal anorm;
00094 integer iuplo, izero, nerrs;
00095 logical zerot;
00096 extern int zpot06_(char *, integer *, integer *,
00097 doublecomplex *, integer *, doublecomplex *, integer *,
00098 doublecomplex *, integer *, doublereal *, doublereal *);
00099 char xtype[1];
00100 extern int zlatb4_(char *, integer *, integer *, integer
00101 *, char *, integer *, integer *, doublereal *, integer *,
00102 doublereal *, char *), alaerh_(char *,
00103 char *, integer *, integer *, char *, integer *, integer *,
00104 integer *, integer *, integer *, integer *, integer *, integer *,
00105 integer *), zlaipd_(integer *,
00106 doublecomplex *, integer *, integer *);
00107 doublereal cndnum;
00108 extern int zlacpy_(char *, integer *, integer *,
00109 doublecomplex *, integer *, doublecomplex *, integer *),
00110 zlarhs_(char *, char *, char *, char *, integer *, integer *,
00111 integer *, integer *, integer *, doublecomplex *, integer *,
00112 doublecomplex *, integer *, doublecomplex *, integer *, integer *,
00113 integer *), zlatms_(integer *,
00114 integer *, char *, integer *, char *, doublereal *, integer *,
00115 doublereal *, doublereal *, integer *, integer *, char *,
00116 doublecomplex *, integer *, doublecomplex *, integer *);
00117 doublereal result[1];
00118 extern int zcposv_(char *, integer *, integer *,
00119 doublecomplex *, integer *, doublecomplex *, integer *,
00120 doublecomplex *, integer *, doublecomplex *, complex *,
00121 doublereal *, integer *, integer *);
00122
00123
00124 static cilist io___32 = { 0, 0, 0, fmt_9988, 0 };
00125 static cilist io___33 = { 0, 0, 0, fmt_9975, 0 };
00126 static cilist io___35 = { 0, 0, 0, fmt_8999, 0 };
00127 static cilist io___36 = { 0, 0, 0, fmt_8979, 0 };
00128 static cilist io___37 = { 0, 0, 0, fmt_8960, 0 };
00129 static cilist io___38 = { 0, 0, 0, fmt_9998, 0 };
00130 static cilist io___39 = { 0, 0, 0, fmt_9996, 0 };
00131 static cilist io___40 = { 0, 0, 0, fmt_9995, 0 };
00132 static cilist io___41 = { 0, 0, 0, fmt_9994, 0 };
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 --swork;
00222 --rwork;
00223 --work;
00224 --x;
00225 --b;
00226 --afac;
00227 --a;
00228 --nsval;
00229 --mval;
00230 --dotype;
00231
00232
00233
00234
00235
00236
00237
00238 kase = 0;
00239 s_copy(path, "Zomplex precision", (ftnlen)1, (ftnlen)17);
00240 s_copy(path + 1, "PO", (ftnlen)2, (ftnlen)2);
00241 nrun = 0;
00242 nfail = 0;
00243 nerrs = 0;
00244 for (i__ = 1; i__ <= 4; ++i__) {
00245 iseed[i__ - 1] = iseedy[i__ - 1];
00246
00247 }
00248
00249 infoc_1.infot = 0;
00250
00251
00252
00253 i__1 = *nm;
00254 for (im = 1; im <= i__1; ++im) {
00255 n = mval[im];
00256 lda = max(n,1);
00257 nimat = 9;
00258 if (n <= 0) {
00259 nimat = 1;
00260 }
00261
00262 i__2 = nimat;
00263 for (imat = 1; imat <= i__2; ++imat) {
00264
00265
00266
00267 if (! dotype[imat]) {
00268 goto L110;
00269 }
00270
00271
00272
00273 zerot = imat >= 3 && imat <= 5;
00274 if (zerot && n < imat - 2) {
00275 goto L110;
00276 }
00277
00278
00279
00280 for (iuplo = 1; iuplo <= 2; ++iuplo) {
00281 *(unsigned char *)uplo = *(unsigned char *)&uplos[iuplo - 1];
00282
00283
00284
00285
00286 zlatb4_(path, &imat, &n, &n, type__, &kl, &ku, &anorm, &mode,
00287 &cndnum, dist);
00288
00289 s_copy(srnamc_1.srnamt, "ZLATMS", (ftnlen)32, (ftnlen)6);
00290 zlatms_(&n, &n, dist, iseed, type__, &rwork[1], &mode, &
00291 cndnum, &anorm, &kl, &ku, uplo, &a[1], &lda, &work[1],
00292 &info);
00293
00294
00295
00296 if (info != 0) {
00297 alaerh_(path, "ZLATMS", &info, &c__0, uplo, &n, &n, &c_n1,
00298 &c_n1, &c_n1, &imat, &nfail, &nerrs, nout);
00299 goto L100;
00300 }
00301
00302
00303
00304
00305 if (zerot) {
00306 if (imat == 3) {
00307 izero = 1;
00308 } else if (imat == 4) {
00309 izero = n;
00310 } else {
00311 izero = n / 2 + 1;
00312 }
00313 ioff = (izero - 1) * lda;
00314
00315
00316
00317 if (iuplo == 1) {
00318 i__3 = izero - 1;
00319 for (i__ = 1; i__ <= i__3; ++i__) {
00320 i__4 = ioff + i__;
00321 a[i__4].r = 0., a[i__4].i = 0.;
00322
00323 }
00324 ioff += izero;
00325 i__3 = n;
00326 for (i__ = izero; i__ <= i__3; ++i__) {
00327 i__4 = ioff;
00328 a[i__4].r = 0., a[i__4].i = 0.;
00329 ioff += lda;
00330
00331 }
00332 } else {
00333 ioff = izero;
00334 i__3 = izero - 1;
00335 for (i__ = 1; i__ <= i__3; ++i__) {
00336 i__4 = ioff;
00337 a[i__4].r = 0., a[i__4].i = 0.;
00338 ioff += lda;
00339
00340 }
00341 ioff -= izero;
00342 i__3 = n;
00343 for (i__ = izero; i__ <= i__3; ++i__) {
00344 i__4 = ioff + i__;
00345 a[i__4].r = 0., a[i__4].i = 0.;
00346
00347 }
00348 }
00349 } else {
00350 izero = 0;
00351 }
00352
00353
00354
00355 i__3 = lda + 1;
00356 zlaipd_(&n, &a[1], &i__3, &c__0);
00357
00358 i__3 = *nns;
00359 for (irhs = 1; irhs <= i__3; ++irhs) {
00360 nrhs = nsval[irhs];
00361 *(unsigned char *)xtype = 'N';
00362
00363
00364
00365 s_copy(srnamc_1.srnamt, "ZLARHS", (ftnlen)32, (ftnlen)6);
00366 zlarhs_(path, xtype, uplo, " ", &n, &n, &kl, &ku, &nrhs, &
00367 a[1], &lda, &x[1], &lda, &b[1], &lda, iseed, &
00368 info);
00369
00370
00371
00372
00373 s_copy(srnamc_1.srnamt, "ZCPOSV ", (ftnlen)32, (ftnlen)7);
00374 ++kase;
00375
00376 zlacpy_("All", &n, &n, &a[1], &lda, &afac[1], &lda);
00377
00378 zcposv_(uplo, &n, &nrhs, &afac[1], &lda, &b[1], &lda, &x[
00379 1], &lda, &work[1], &swork[1], &rwork[1], &iter, &
00380 info);
00381
00382 if (iter < 0) {
00383 zlacpy_("All", &n, &n, &a[1], &lda, &afac[1], &lda);
00384 }
00385
00386
00387
00388 if (info != izero) {
00389
00390 if (nfail == 0 && nerrs == 0) {
00391 alahd_(nout, path);
00392 }
00393 ++nerrs;
00394
00395 if (info != izero && izero != 0) {
00396 io___32.ciunit = *nout;
00397 s_wsfe(&io___32);
00398 do_fio(&c__1, "ZCPOSV", (ftnlen)6);
00399 do_fio(&c__1, (char *)&info, (ftnlen)sizeof(
00400 integer));
00401 do_fio(&c__1, (char *)&izero, (ftnlen)sizeof(
00402 integer));
00403 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer))
00404 ;
00405 do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(
00406 integer));
00407 e_wsfe();
00408 } else {
00409 io___33.ciunit = *nout;
00410 s_wsfe(&io___33);
00411 do_fio(&c__1, "ZCPOSV", (ftnlen)6);
00412 do_fio(&c__1, (char *)&info, (ftnlen)sizeof(
00413 integer));
00414 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer))
00415 ;
00416 do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(
00417 integer));
00418 e_wsfe();
00419 }
00420 }
00421
00422
00423
00424 if (info != 0) {
00425 goto L110;
00426 }
00427
00428
00429
00430 zlacpy_("All", &n, &nrhs, &b[1], &lda, &work[1], &lda);
00431
00432 zpot06_(uplo, &n, &nrhs, &a[1], &lda, &x[1], &lda, &work[
00433 1], &lda, &rwork[1], result);
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447 if (*thresh <= 0.f || iter >= 0 && n > 0 && result[0] >=
00448 sqrt((doublereal) n) || iter < 0 && result[0] >= *
00449 thresh) {
00450
00451 if (nfail == 0 && nerrs == 0) {
00452 io___35.ciunit = *nout;
00453 s_wsfe(&io___35);
00454 do_fio(&c__1, "ZPO", (ftnlen)3);
00455 e_wsfe();
00456 ci__1.cierr = 0;
00457 ci__1.ciunit = *nout;
00458 ci__1.cifmt = "( ' Matrix types:' )";
00459 s_wsfe(&ci__1);
00460 e_wsfe();
00461 io___36.ciunit = *nout;
00462 s_wsfe(&io___36);
00463 e_wsfe();
00464 ci__1.cierr = 0;
00465 ci__1.ciunit = *nout;
00466 ci__1.cifmt = "( ' Test ratios:' )";
00467 s_wsfe(&ci__1);
00468 e_wsfe();
00469 io___37.ciunit = *nout;
00470 s_wsfe(&io___37);
00471 do_fio(&c__1, (char *)&c__1, (ftnlen)sizeof(
00472 integer));
00473 e_wsfe();
00474 ci__1.cierr = 0;
00475 ci__1.ciunit = *nout;
00476 ci__1.cifmt = "( ' Messages:' )";
00477 s_wsfe(&ci__1);
00478 e_wsfe();
00479 }
00480
00481 io___38.ciunit = *nout;
00482 s_wsfe(&io___38);
00483 do_fio(&c__1, uplo, (ftnlen)1);
00484 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00485 do_fio(&c__1, (char *)&nrhs, (ftnlen)sizeof(integer));
00486 do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(integer));
00487 do_fio(&c__1, (char *)&c__1, (ftnlen)sizeof(integer));
00488 do_fio(&c__1, (char *)&result[0], (ftnlen)sizeof(
00489 doublereal));
00490 e_wsfe();
00491
00492 ++nfail;
00493
00494 }
00495
00496 ++nrun;
00497
00498
00499 }
00500 L100:
00501 ;
00502 }
00503 L110:
00504 ;
00505 }
00506
00507 }
00508
00509
00510
00511
00512
00513 if (nfail > 0) {
00514 io___39.ciunit = *nout;
00515 s_wsfe(&io___39);
00516 do_fio(&c__1, "ZCPOSV", (ftnlen)6);
00517 do_fio(&c__1, (char *)&nfail, (ftnlen)sizeof(integer));
00518 do_fio(&c__1, (char *)&nrun, (ftnlen)sizeof(integer));
00519 e_wsfe();
00520 } else {
00521 io___40.ciunit = *nout;
00522 s_wsfe(&io___40);
00523 do_fio(&c__1, "ZCPOSV", (ftnlen)6);
00524 do_fio(&c__1, (char *)&nrun, (ftnlen)sizeof(integer));
00525 e_wsfe();
00526 }
00527 if (nerrs > 0) {
00528 io___41.ciunit = *nout;
00529 s_wsfe(&io___41);
00530 do_fio(&c__1, (char *)&nerrs, (ftnlen)sizeof(integer));
00531 e_wsfe();
00532 }
00533
00534
00535
00536
00537
00538
00539
00540 return 0;
00541
00542
00543
00544 }