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