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 static integer c__8 = 8;
00037
00038 int cchkpo_(logical *dotype, integer *nn, integer *nval,
00039 integer *nnb, integer *nbval, integer *nns, integer *nsval, real *
00040 thresh, logical *tsterr, integer *nmax, complex *a, complex *afac,
00041 complex *ainv, complex *b, complex *x, complex *xact, complex *work,
00042 real *rwork, integer *nout)
00043 {
00044
00045
00046 static integer iseedy[4] = { 1988,1989,1990,1991 };
00047 static char uplos[1*2] = "U" "L";
00048
00049
00050 static char fmt_9999[] = "(\002 UPLO = '\002,a1,\002', N =\002,i5,\002, "
00051 "NB =\002,i4,\002, type \002,i2,\002, test \002,i2,\002, ratio "
00052 "=\002,g12.5)";
00053 static char fmt_9998[] = "(\002 UPLO = '\002,a1,\002', N =\002,i5,\002, "
00054 "NRHS=\002,i3,\002, type \002,i2,\002, test(\002,i2,\002) =\002,g"
00055 "12.5)";
00056 static char fmt_9997[] = "(\002 UPLO = '\002,a1,\002', N =\002,i5,\002"
00057 ",\002,10x,\002 type \002,i2,\002, test(\002,i2,\002) =\002,g12.5)"
00058 ;
00059
00060
00061 integer i__1, i__2, i__3, i__4;
00062
00063
00064 int s_copy(char *, char *, ftnlen, ftnlen);
00065 integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
00066
00067
00068 integer i__, k, n, nb, in, kl, ku, lda, inb, ioff, mode, imat, info;
00069 char path[3], dist[1];
00070 integer irhs, nrhs;
00071 char uplo[1], type__[1];
00072 integer nrun;
00073 extern int alahd_(integer *, char *), cget04_(
00074 integer *, integer *, complex *, integer *, complex *, integer *,
00075 real *, real *);
00076 integer nfail, iseed[4];
00077 real rcond;
00078 extern int cpot01_(char *, integer *, complex *, integer
00079 *, complex *, integer *, real *, real *), cpot02_(char *,
00080 integer *, integer *, complex *, integer *, complex *, integer *,
00081 complex *, integer *, real *, real *);
00082 integer nimat;
00083 extern doublereal sget06_(real *, real *);
00084 extern int cpot03_(char *, integer *, complex *, integer
00085 *, complex *, integer *, complex *, integer *, real *, real *,
00086 real *), cpot05_(char *, integer *, integer *, complex *,
00087 integer *, complex *, integer *, complex *, integer *, complex *,
00088 integer *, real *, real *, real *);
00089 real anorm;
00090 integer iuplo, izero, nerrs;
00091 logical zerot;
00092 char xtype[1];
00093 extern int clatb4_(char *, integer *, integer *, integer
00094 *, char *, integer *, integer *, real *, integer *, real *, char *
00095 );
00096 extern doublereal clanhe_(char *, char *, integer *, complex *, integer *,
00097 real *);
00098 extern int alaerh_(char *, char *, integer *, integer *,
00099 char *, integer *, integer *, integer *, integer *, integer *,
00100 integer *, integer *, integer *, integer *), claipd_(integer *, complex *, integer *, integer *);
00101 real rcondc;
00102 extern int clacpy_(char *, integer *, integer *, complex
00103 *, integer *, complex *, integer *), clarhs_(char *, char
00104 *, char *, char *, integer *, integer *, integer *, integer *,
00105 integer *, complex *, integer *, complex *, integer *, complex *,
00106 integer *, integer *, integer *),
00107 cpocon_(char *, integer *, complex *, integer *, real *, real *,
00108 complex *, real *, integer *), alasum_(char *, integer *,
00109 integer *, integer *, integer *);
00110 real cndnum;
00111 extern int clatms_(integer *, integer *, char *, integer
00112 *, char *, real *, integer *, real *, real *, integer *, integer *
00113 , char *, complex *, integer *, complex *, integer *), cerrpo_(char *, integer *), cporfs_(char
00114 *, integer *, integer *, complex *, integer *, complex *, integer
00115 *, complex *, integer *, complex *, integer *, real *, real *,
00116 complex *, real *, integer *), cpotrf_(char *, integer *,
00117 complex *, integer *, integer *), xlaenv_(integer *,
00118 integer *), cpotri_(char *, integer *, complex *, integer *,
00119 integer *), cpotrs_(char *, integer *, integer *, complex
00120 *, integer *, complex *, integer *, integer *);
00121 real result[8];
00122
00123
00124 static cilist io___33 = { 0, 0, 0, fmt_9999, 0 };
00125 static cilist io___36 = { 0, 0, 0, fmt_9998, 0 };
00126 static cilist io___38 = { 0, 0, 0, fmt_9997, 0 };
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 --rwork;
00225 --work;
00226 --xact;
00227 --x;
00228 --b;
00229 --ainv;
00230 --afac;
00231 --a;
00232 --nsval;
00233 --nbval;
00234 --nval;
00235 --dotype;
00236
00237
00238
00239
00240
00241
00242
00243 s_copy(path, "Complex precision", (ftnlen)1, (ftnlen)17);
00244 s_copy(path + 1, "PO", (ftnlen)2, (ftnlen)2);
00245 nrun = 0;
00246 nfail = 0;
00247 nerrs = 0;
00248 for (i__ = 1; i__ <= 4; ++i__) {
00249 iseed[i__ - 1] = iseedy[i__ - 1];
00250
00251 }
00252
00253
00254
00255 if (*tsterr) {
00256 cerrpo_(path, nout);
00257 }
00258 infoc_1.infot = 0;
00259
00260
00261
00262 i__1 = *nn;
00263 for (in = 1; in <= i__1; ++in) {
00264 n = nval[in];
00265 lda = max(n,1);
00266 *(unsigned char *)xtype = 'N';
00267 nimat = 9;
00268 if (n <= 0) {
00269 nimat = 1;
00270 }
00271
00272 izero = 0;
00273 i__2 = nimat;
00274 for (imat = 1; imat <= i__2; ++imat) {
00275
00276
00277
00278 if (! dotype[imat]) {
00279 goto L110;
00280 }
00281
00282
00283
00284 zerot = imat >= 3 && imat <= 5;
00285 if (zerot && n < imat - 2) {
00286 goto L110;
00287 }
00288
00289
00290
00291 for (iuplo = 1; iuplo <= 2; ++iuplo) {
00292 *(unsigned char *)uplo = *(unsigned char *)&uplos[iuplo - 1];
00293
00294
00295
00296
00297 clatb4_(path, &imat, &n, &n, type__, &kl, &ku, &anorm, &mode,
00298 &cndnum, dist);
00299
00300 s_copy(srnamc_1.srnamt, "CLATMS", (ftnlen)32, (ftnlen)6);
00301 clatms_(&n, &n, dist, iseed, type__, &rwork[1], &mode, &
00302 cndnum, &anorm, &kl, &ku, uplo, &a[1], &lda, &work[1],
00303 &info);
00304
00305
00306
00307 if (info != 0) {
00308 alaerh_(path, "CLATMS", &info, &c__0, uplo, &n, &n, &c_n1,
00309 &c_n1, &c_n1, &imat, &nfail, &nerrs, nout);
00310 goto L100;
00311 }
00312
00313
00314
00315
00316 if (zerot) {
00317 if (imat == 3) {
00318 izero = 1;
00319 } else if (imat == 4) {
00320 izero = n;
00321 } else {
00322 izero = n / 2 + 1;
00323 }
00324 ioff = (izero - 1) * lda;
00325
00326
00327
00328 if (iuplo == 1) {
00329 i__3 = izero - 1;
00330 for (i__ = 1; i__ <= i__3; ++i__) {
00331 i__4 = ioff + i__;
00332 a[i__4].r = 0.f, a[i__4].i = 0.f;
00333
00334 }
00335 ioff += izero;
00336 i__3 = n;
00337 for (i__ = izero; i__ <= i__3; ++i__) {
00338 i__4 = ioff;
00339 a[i__4].r = 0.f, a[i__4].i = 0.f;
00340 ioff += lda;
00341
00342 }
00343 } else {
00344 ioff = izero;
00345 i__3 = izero - 1;
00346 for (i__ = 1; i__ <= i__3; ++i__) {
00347 i__4 = ioff;
00348 a[i__4].r = 0.f, a[i__4].i = 0.f;
00349 ioff += lda;
00350
00351 }
00352 ioff -= izero;
00353 i__3 = n;
00354 for (i__ = izero; i__ <= i__3; ++i__) {
00355 i__4 = ioff + i__;
00356 a[i__4].r = 0.f, a[i__4].i = 0.f;
00357
00358 }
00359 }
00360 } else {
00361 izero = 0;
00362 }
00363
00364
00365
00366 i__3 = lda + 1;
00367 claipd_(&n, &a[1], &i__3, &c__0);
00368
00369
00370
00371 i__3 = *nnb;
00372 for (inb = 1; inb <= i__3; ++inb) {
00373 nb = nbval[inb];
00374 xlaenv_(&c__1, &nb);
00375
00376
00377
00378 clacpy_(uplo, &n, &n, &a[1], &lda, &afac[1], &lda);
00379 s_copy(srnamc_1.srnamt, "CPOTRF", (ftnlen)32, (ftnlen)6);
00380 cpotrf_(uplo, &n, &afac[1], &lda, &info);
00381
00382
00383
00384 if (info != izero) {
00385 alaerh_(path, "CPOTRF", &info, &izero, uplo, &n, &n, &
00386 c_n1, &c_n1, &nb, &imat, &nfail, &nerrs, nout);
00387 goto L90;
00388 }
00389
00390
00391
00392 if (info != 0) {
00393 goto L90;
00394 }
00395
00396
00397
00398
00399 clacpy_(uplo, &n, &n, &afac[1], &lda, &ainv[1], &lda);
00400 cpot01_(uplo, &n, &a[1], &lda, &ainv[1], &lda, &rwork[1],
00401 result);
00402
00403
00404
00405
00406 clacpy_(uplo, &n, &n, &afac[1], &lda, &ainv[1], &lda);
00407 s_copy(srnamc_1.srnamt, "CPOTRI", (ftnlen)32, (ftnlen)6);
00408 cpotri_(uplo, &n, &ainv[1], &lda, &info);
00409
00410
00411
00412 if (info != 0) {
00413 alaerh_(path, "CPOTRI", &info, &c__0, uplo, &n, &n, &
00414 c_n1, &c_n1, &c_n1, &imat, &nfail, &nerrs,
00415 nout);
00416 }
00417
00418 cpot03_(uplo, &n, &a[1], &lda, &ainv[1], &lda, &work[1], &
00419 lda, &rwork[1], &rcondc, &result[1]);
00420
00421
00422
00423
00424 for (k = 1; k <= 2; ++k) {
00425 if (result[k - 1] >= *thresh) {
00426 if (nfail == 0 && nerrs == 0) {
00427 alahd_(nout, path);
00428 }
00429 io___33.ciunit = *nout;
00430 s_wsfe(&io___33);
00431 do_fio(&c__1, uplo, (ftnlen)1);
00432 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer))
00433 ;
00434 do_fio(&c__1, (char *)&nb, (ftnlen)sizeof(integer)
00435 );
00436 do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(
00437 integer));
00438 do_fio(&c__1, (char *)&k, (ftnlen)sizeof(integer))
00439 ;
00440 do_fio(&c__1, (char *)&result[k - 1], (ftnlen)
00441 sizeof(real));
00442 e_wsfe();
00443 ++nfail;
00444 }
00445
00446 }
00447 nrun += 2;
00448
00449
00450
00451
00452 if (inb != 1) {
00453 goto L90;
00454 }
00455
00456 i__4 = *nns;
00457 for (irhs = 1; irhs <= i__4; ++irhs) {
00458 nrhs = nsval[irhs];
00459
00460
00461
00462
00463 s_copy(srnamc_1.srnamt, "CLARHS", (ftnlen)32, (ftnlen)
00464 6);
00465 clarhs_(path, xtype, uplo, " ", &n, &n, &kl, &ku, &
00466 nrhs, &a[1], &lda, &xact[1], &lda, &b[1], &
00467 lda, iseed, &info);
00468 clacpy_("Full", &n, &nrhs, &b[1], &lda, &x[1], &lda);
00469
00470 s_copy(srnamc_1.srnamt, "CPOTRS", (ftnlen)32, (ftnlen)
00471 6);
00472 cpotrs_(uplo, &n, &nrhs, &afac[1], &lda, &x[1], &lda,
00473 &info);
00474
00475
00476
00477 if (info != 0) {
00478 alaerh_(path, "CPOTRS", &info, &c__0, uplo, &n, &
00479 n, &c_n1, &c_n1, &nrhs, &imat, &nfail, &
00480 nerrs, nout);
00481 }
00482
00483 clacpy_("Full", &n, &nrhs, &b[1], &lda, &work[1], &
00484 lda);
00485 cpot02_(uplo, &n, &nrhs, &a[1], &lda, &x[1], &lda, &
00486 work[1], &lda, &rwork[1], &result[2]);
00487
00488
00489
00490
00491 cget04_(&n, &nrhs, &x[1], &lda, &xact[1], &lda, &
00492 rcondc, &result[3]);
00493
00494
00495
00496
00497 s_copy(srnamc_1.srnamt, "CPORFS", (ftnlen)32, (ftnlen)
00498 6);
00499 cporfs_(uplo, &n, &nrhs, &a[1], &lda, &afac[1], &lda,
00500 &b[1], &lda, &x[1], &lda, &rwork[1], &rwork[
00501 nrhs + 1], &work[1], &rwork[(nrhs << 1) + 1],
00502 &info);
00503
00504
00505
00506 if (info != 0) {
00507 alaerh_(path, "CPORFS", &info, &c__0, uplo, &n, &
00508 n, &c_n1, &c_n1, &nrhs, &imat, &nfail, &
00509 nerrs, nout);
00510 }
00511
00512 cget04_(&n, &nrhs, &x[1], &lda, &xact[1], &lda, &
00513 rcondc, &result[4]);
00514 cpot05_(uplo, &n, &nrhs, &a[1], &lda, &b[1], &lda, &x[
00515 1], &lda, &xact[1], &lda, &rwork[1], &rwork[
00516 nrhs + 1], &result[5]);
00517
00518
00519
00520
00521 for (k = 3; k <= 7; ++k) {
00522 if (result[k - 1] >= *thresh) {
00523 if (nfail == 0 && nerrs == 0) {
00524 alahd_(nout, path);
00525 }
00526 io___36.ciunit = *nout;
00527 s_wsfe(&io___36);
00528 do_fio(&c__1, uplo, (ftnlen)1);
00529 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(
00530 integer));
00531 do_fio(&c__1, (char *)&nrhs, (ftnlen)sizeof(
00532 integer));
00533 do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(
00534 integer));
00535 do_fio(&c__1, (char *)&k, (ftnlen)sizeof(
00536 integer));
00537 do_fio(&c__1, (char *)&result[k - 1], (ftnlen)
00538 sizeof(real));
00539 e_wsfe();
00540 ++nfail;
00541 }
00542
00543 }
00544 nrun += 5;
00545
00546 }
00547
00548
00549
00550
00551 anorm = clanhe_("1", uplo, &n, &a[1], &lda, &rwork[1]);
00552 s_copy(srnamc_1.srnamt, "CPOCON", (ftnlen)32, (ftnlen)6);
00553 cpocon_(uplo, &n, &afac[1], &lda, &anorm, &rcond, &work[1]
00554 , &rwork[1], &info);
00555
00556
00557
00558 if (info != 0) {
00559 alaerh_(path, "CPOCON", &info, &c__0, uplo, &n, &n, &
00560 c_n1, &c_n1, &c_n1, &imat, &nfail, &nerrs,
00561 nout);
00562 }
00563
00564 result[7] = sget06_(&rcond, &rcondc);
00565
00566
00567
00568 if (result[7] >= *thresh) {
00569 if (nfail == 0 && nerrs == 0) {
00570 alahd_(nout, path);
00571 }
00572 io___38.ciunit = *nout;
00573 s_wsfe(&io___38);
00574 do_fio(&c__1, uplo, (ftnlen)1);
00575 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00576 do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(integer));
00577 do_fio(&c__1, (char *)&c__8, (ftnlen)sizeof(integer));
00578 do_fio(&c__1, (char *)&result[7], (ftnlen)sizeof(real)
00579 );
00580 e_wsfe();
00581 ++nfail;
00582 }
00583 ++nrun;
00584 L90:
00585 ;
00586 }
00587 L100:
00588 ;
00589 }
00590 L110:
00591 ;
00592 }
00593
00594 }
00595
00596
00597
00598 alasum_(path, nout, &nfail, &nrun, &nerrs);
00599
00600 return 0;
00601
00602
00603
00604 }