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