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