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