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