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, iounit;
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__0 = 0;
00035 static integer c_n1 = -1;
00036 static integer c__2 = 2;
00037 static integer c__3 = 3;
00038 static integer c__7 = 7;
00039 static integer c__4 = 4;
00040 static real c_b99 = 1.f;
00041 static integer c__8 = 8;
00042 static integer c__9 = 9;
00043
00044 int cchktr_(logical *dotype, integer *nn, integer *nval,
00045 integer *nnb, integer *nbval, integer *nns, integer *nsval, real *
00046 thresh, logical *tsterr, integer *nmax, complex *a, complex *ainv,
00047 complex *b, complex *x, complex *xact, complex *work, real *rwork,
00048 integer *nout)
00049 {
00050
00051
00052 static integer iseedy[4] = { 1988,1989,1990,1991 };
00053 static char uplos[1*2] = "U" "L";
00054 static char transs[1*3] = "N" "T" "C";
00055
00056
00057 static char fmt_9999[] = "(\002 UPLO='\002,a1,\002', DIAG='\002,a1,\002'"
00058 ", N=\002,i5,\002, NB=\002,i4,\002, type \002,i2,\002, test(\002,"
00059 "i2,\002)= \002,g12.5)";
00060 static char fmt_9998[] = "(\002 UPLO='\002,a1,\002', TRANS='\002,a1,\002"
00061 "', DIAG='\002,a1,\002', N=\002,i5,\002, NB=\002,i4,\002, type"
00062 " \002,i2,\002, test(\002,i2,\002)= \002,g12"
00063 ".5)";
00064 static char fmt_9997[] = "(\002 NORM='\002,a1,\002', UPLO ='\002,a1,\002"
00065 "', N=\002,i5,\002,\002,11x,\002 type \002,i2,\002, test(\002,i2"
00066 ",\002)=\002,g12.5)";
00067 static char fmt_9996[] = "(1x,a,\002( '\002,a1,\002', '\002,a1,\002', "
00068 "'\002,a1,\002', '\002,a1,\002',\002,i5,\002, ... ), type \002,i2,"
00069 "\002, test(\002,i2,\002)=\002,g12.5)";
00070
00071
00072 address a__1[2], a__2[3], a__3[4];
00073 integer i__1, i__2, i__3[2], i__4, i__5[3], i__6[4];
00074 char ch__1[2], ch__2[3], ch__3[4];
00075
00076
00077 int s_copy(char *, char *, ftnlen, ftnlen), s_cat(char *,
00078 char **, integer *, integer *, ftnlen);
00079 integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
00080
00081
00082 integer i__, k, n, nb, in, lda, inb;
00083 char diag[1];
00084 integer imat, info;
00085 char path[3];
00086 integer irhs, nrhs;
00087 char norm[1], uplo[1];
00088 integer nrun;
00089 extern int alahd_(integer *, char *);
00090 integer idiag;
00091 extern int cget04_(integer *, integer *, complex *,
00092 integer *, complex *, integer *, real *, real *);
00093 real scale;
00094 integer nfail, iseed[4];
00095 extern logical lsame_(char *, char *);
00096 real rcond, anorm;
00097 integer itran;
00098 extern int ccopy_(integer *, complex *, integer *,
00099 complex *, integer *), ctrt01_(char *, char *, integer *, complex
00100 *, integer *, complex *, integer *, real *, real *, real *), ctrt02_(char *, char *, char *, integer *,
00101 integer *, complex *, integer *, complex *, integer *, complex *,
00102 integer *, complex *, real *, real *),
00103 ctrt03_(char *, char *, char *, integer *, integer *, complex *,
00104 integer *, real *, real *, real *, complex *, integer *, complex *
00105 , integer *, complex *, real *), ctrt05_(
00106 char *, char *, char *, integer *, integer *, complex *, integer *
00107 , complex *, integer *, complex *, integer *, complex *, integer *
00108 , real *, real *, real *), ctrt06_(real *,
00109 real *, char *, char *, integer *, complex *, integer *, real *,
00110 real *);
00111 char trans[1];
00112 integer iuplo, nerrs;
00113 real dummy;
00114 char xtype[1];
00115 extern int alaerh_(char *, char *, integer *, integer *,
00116 char *, integer *, integer *, integer *, integer *, integer *,
00117 integer *, integer *, integer *, integer *);
00118 real rcondc;
00119 extern int clacpy_(char *, integer *, integer *, complex
00120 *, integer *, complex *, integer *), clarhs_(char *, char
00121 *, char *, char *, integer *, integer *, integer *, integer *,
00122 integer *, complex *, integer *, complex *, integer *, complex *,
00123 integer *, integer *, integer *);
00124 real rcondi;
00125 extern doublereal clantr_(char *, char *, char *, integer *, integer *,
00126 complex *, integer *, real *);
00127 real rcondo;
00128 extern int alasum_(char *, integer *, integer *, integer
00129 *, integer *);
00130 real ainvnm;
00131 extern int clatrs_(char *, char *, char *, char *,
00132 integer *, complex *, integer *, complex *, real *, real *,
00133 integer *), clattr_(integer *,
00134 char *, char *, char *, integer *, integer *, complex *, integer *
00135 , complex *, complex *, real *, integer *)
00136 , ctrcon_(char *, char *, char *, integer *, complex *, integer *,
00137 real *, complex *, real *, integer *),
00138 xlaenv_(integer *, integer *), cerrtr_(char *, integer *),
00139 ctrrfs_(char *, char *, char *, integer *, integer *, complex *,
00140 integer *, complex *, integer *, complex *, integer *, real *,
00141 real *, complex *, real *, integer *),
00142 ctrtri_(char *, char *, integer *, complex *, integer *, integer *
00143 );
00144 real result[9];
00145 extern int ctrtrs_(char *, char *, char *, integer *,
00146 integer *, complex *, integer *, complex *, integer *, integer *);
00147
00148
00149 static cilist io___27 = { 0, 0, 0, fmt_9999, 0 };
00150 static cilist io___36 = { 0, 0, 0, fmt_9998, 0 };
00151 static cilist io___38 = { 0, 0, 0, fmt_9997, 0 };
00152 static cilist io___40 = { 0, 0, 0, fmt_9996, 0 };
00153 static cilist io___41 = { 0, 0, 0, fmt_9996, 0 };
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
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249 --rwork;
00250 --work;
00251 --xact;
00252 --x;
00253 --b;
00254 --ainv;
00255 --a;
00256 --nsval;
00257 --nbval;
00258 --nval;
00259 --dotype;
00260
00261
00262
00263
00264
00265
00266
00267 s_copy(path, "Complex precision", (ftnlen)1, (ftnlen)17);
00268 s_copy(path + 1, "TR", (ftnlen)2, (ftnlen)2);
00269 nrun = 0;
00270 nfail = 0;
00271 nerrs = 0;
00272 for (i__ = 1; i__ <= 4; ++i__) {
00273 iseed[i__ - 1] = iseedy[i__ - 1];
00274
00275 }
00276
00277
00278
00279 if (*tsterr) {
00280 cerrtr_(path, nout);
00281 }
00282 infoc_1.infot = 0;
00283
00284 i__1 = *nn;
00285 for (in = 1; in <= i__1; ++in) {
00286
00287
00288
00289 n = nval[in];
00290 lda = max(1,n);
00291 *(unsigned char *)xtype = 'N';
00292
00293 for (imat = 1; imat <= 10; ++imat) {
00294
00295
00296
00297 if (! dotype[imat]) {
00298 goto L80;
00299 }
00300
00301 for (iuplo = 1; iuplo <= 2; ++iuplo) {
00302
00303
00304
00305 *(unsigned char *)uplo = *(unsigned char *)&uplos[iuplo - 1];
00306
00307
00308
00309 s_copy(srnamc_1.srnamt, "CLATTR", (ftnlen)32, (ftnlen)6);
00310 clattr_(&imat, uplo, "No transpose", diag, iseed, &n, &a[1], &
00311 lda, &x[1], &work[1], &rwork[1], &info);
00312
00313
00314
00315 if (lsame_(diag, "N")) {
00316 idiag = 1;
00317 } else {
00318 idiag = 2;
00319 }
00320
00321 i__2 = *nnb;
00322 for (inb = 1; inb <= i__2; ++inb) {
00323
00324
00325
00326 nb = nbval[inb];
00327 xlaenv_(&c__1, &nb);
00328
00329
00330
00331
00332 clacpy_(uplo, &n, &n, &a[1], &lda, &ainv[1], &lda);
00333 s_copy(srnamc_1.srnamt, "CTRTRI", (ftnlen)32, (ftnlen)6);
00334 ctrtri_(uplo, diag, &n, &ainv[1], &lda, &info);
00335
00336
00337
00338 if (info != 0) {
00339
00340 i__3[0] = 1, a__1[0] = uplo;
00341 i__3[1] = 1, a__1[1] = diag;
00342 s_cat(ch__1, a__1, i__3, &c__2, (ftnlen)2);
00343 alaerh_(path, "CTRTRI", &info, &c__0, ch__1, &n, &n, &
00344 c_n1, &c_n1, &nb, &imat, &nfail, &nerrs, nout);
00345 }
00346
00347
00348
00349 anorm = clantr_("I", uplo, diag, &n, &n, &a[1], &lda, &
00350 rwork[1]);
00351 ainvnm = clantr_("I", uplo, diag, &n, &n, &ainv[1], &lda,
00352 &rwork[1]);
00353 if (anorm <= 0.f || ainvnm <= 0.f) {
00354 rcondi = 1.f;
00355 } else {
00356 rcondi = 1.f / anorm / ainvnm;
00357 }
00358
00359
00360
00361
00362
00363 ctrt01_(uplo, diag, &n, &a[1], &lda, &ainv[1], &lda, &
00364 rcondo, &rwork[1], result);
00365
00366
00367 if (result[0] >= *thresh) {
00368 if (nfail == 0 && nerrs == 0) {
00369 alahd_(nout, path);
00370 }
00371 io___27.ciunit = *nout;
00372 s_wsfe(&io___27);
00373 do_fio(&c__1, uplo, (ftnlen)1);
00374 do_fio(&c__1, diag, (ftnlen)1);
00375 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00376 do_fio(&c__1, (char *)&nb, (ftnlen)sizeof(integer));
00377 do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(integer));
00378 do_fio(&c__1, (char *)&c__1, (ftnlen)sizeof(integer));
00379 do_fio(&c__1, (char *)&result[0], (ftnlen)sizeof(real)
00380 );
00381 e_wsfe();
00382 ++nfail;
00383 }
00384 ++nrun;
00385
00386
00387
00388 if (inb != 1) {
00389 goto L60;
00390 }
00391
00392 i__4 = *nns;
00393 for (irhs = 1; irhs <= i__4; ++irhs) {
00394 nrhs = nsval[irhs];
00395 *(unsigned char *)xtype = 'N';
00396
00397 for (itran = 1; itran <= 3; ++itran) {
00398
00399
00400
00401 *(unsigned char *)trans = *(unsigned char *)&
00402 transs[itran - 1];
00403 if (itran == 1) {
00404 *(unsigned char *)norm = 'O';
00405 rcondc = rcondo;
00406 } else {
00407 *(unsigned char *)norm = 'I';
00408 rcondc = rcondi;
00409 }
00410
00411
00412
00413
00414 s_copy(srnamc_1.srnamt, "CLARHS", (ftnlen)32, (
00415 ftnlen)6);
00416 clarhs_(path, xtype, uplo, trans, &n, &n, &c__0, &
00417 idiag, &nrhs, &a[1], &lda, &xact[1], &lda,
00418 &b[1], &lda, iseed, &info);
00419 *(unsigned char *)xtype = 'C';
00420 clacpy_("Full", &n, &nrhs, &b[1], &lda, &x[1], &
00421 lda);
00422
00423 s_copy(srnamc_1.srnamt, "CTRTRS", (ftnlen)32, (
00424 ftnlen)6);
00425 ctrtrs_(uplo, trans, diag, &n, &nrhs, &a[1], &lda,
00426 &x[1], &lda, &info);
00427
00428
00429
00430 if (info != 0) {
00431
00432 i__5[0] = 1, a__2[0] = uplo;
00433 i__5[1] = 1, a__2[1] = trans;
00434 i__5[2] = 1, a__2[2] = diag;
00435 s_cat(ch__2, a__2, i__5, &c__3, (ftnlen)3);
00436 alaerh_(path, "CTRTRS", &info, &c__0, ch__2, &
00437 n, &n, &c_n1, &c_n1, &nrhs, &imat, &
00438 nfail, &nerrs, nout);
00439 }
00440
00441
00442
00443 if (n > 0) {
00444 dummy = a[1].r;
00445 }
00446
00447 ctrt02_(uplo, trans, diag, &n, &nrhs, &a[1], &lda,
00448 &x[1], &lda, &b[1], &lda, &work[1], &
00449 rwork[1], &result[1]);
00450
00451
00452
00453
00454 cget04_(&n, &nrhs, &x[1], &lda, &xact[1], &lda, &
00455 rcondc, &result[2]);
00456
00457
00458
00459
00460
00461 s_copy(srnamc_1.srnamt, "CTRRFS", (ftnlen)32, (
00462 ftnlen)6);
00463 ctrrfs_(uplo, trans, diag, &n, &nrhs, &a[1], &lda,
00464 &b[1], &lda, &x[1], &lda, &rwork[1], &
00465 rwork[nrhs + 1], &work[1], &rwork[(nrhs <<
00466 1) + 1], &info);
00467
00468
00469
00470 if (info != 0) {
00471
00472 i__5[0] = 1, a__2[0] = uplo;
00473 i__5[1] = 1, a__2[1] = trans;
00474 i__5[2] = 1, a__2[2] = diag;
00475 s_cat(ch__2, a__2, i__5, &c__3, (ftnlen)3);
00476 alaerh_(path, "CTRRFS", &info, &c__0, ch__2, &
00477 n, &n, &c_n1, &c_n1, &nrhs, &imat, &
00478 nfail, &nerrs, nout);
00479 }
00480
00481 cget04_(&n, &nrhs, &x[1], &lda, &xact[1], &lda, &
00482 rcondc, &result[3]);
00483 ctrt05_(uplo, trans, diag, &n, &nrhs, &a[1], &lda,
00484 &b[1], &lda, &x[1], &lda, &xact[1], &lda,
00485 &rwork[1], &rwork[nrhs + 1], &result[4]);
00486
00487
00488
00489
00490 for (k = 2; k <= 6; ++k) {
00491 if (result[k - 1] >= *thresh) {
00492 if (nfail == 0 && nerrs == 0) {
00493 alahd_(nout, path);
00494 }
00495 io___36.ciunit = *nout;
00496 s_wsfe(&io___36);
00497 do_fio(&c__1, uplo, (ftnlen)1);
00498 do_fio(&c__1, trans, (ftnlen)1);
00499 do_fio(&c__1, diag, (ftnlen)1);
00500 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(
00501 integer));
00502 do_fio(&c__1, (char *)&nrhs, (ftnlen)
00503 sizeof(integer));
00504 do_fio(&c__1, (char *)&imat, (ftnlen)
00505 sizeof(integer));
00506 do_fio(&c__1, (char *)&k, (ftnlen)sizeof(
00507 integer));
00508 do_fio(&c__1, (char *)&result[k - 1], (
00509 ftnlen)sizeof(real));
00510 e_wsfe();
00511 ++nfail;
00512 }
00513
00514 }
00515 nrun += 5;
00516
00517 }
00518
00519 }
00520
00521
00522
00523
00524 for (itran = 1; itran <= 2; ++itran) {
00525 if (itran == 1) {
00526 *(unsigned char *)norm = 'O';
00527 rcondc = rcondo;
00528 } else {
00529 *(unsigned char *)norm = 'I';
00530 rcondc = rcondi;
00531 }
00532 s_copy(srnamc_1.srnamt, "CTRCON", (ftnlen)32, (ftnlen)
00533 6);
00534 ctrcon_(norm, uplo, diag, &n, &a[1], &lda, &rcond, &
00535 work[1], &rwork[1], &info);
00536
00537
00538
00539 if (info != 0) {
00540
00541 i__5[0] = 1, a__2[0] = norm;
00542 i__5[1] = 1, a__2[1] = uplo;
00543 i__5[2] = 1, a__2[2] = diag;
00544 s_cat(ch__2, a__2, i__5, &c__3, (ftnlen)3);
00545 alaerh_(path, "CTRCON", &info, &c__0, ch__2, &n, &
00546 n, &c_n1, &c_n1, &c_n1, &imat, &nfail, &
00547 nerrs, nout);
00548 }
00549
00550 ctrt06_(&rcond, &rcondc, uplo, diag, &n, &a[1], &lda,
00551 &rwork[1], &result[6]);
00552
00553
00554
00555 if (result[6] >= *thresh) {
00556 if (nfail == 0 && nerrs == 0) {
00557 alahd_(nout, path);
00558 }
00559 io___38.ciunit = *nout;
00560 s_wsfe(&io___38);
00561 do_fio(&c__1, norm, (ftnlen)1);
00562 do_fio(&c__1, uplo, (ftnlen)1);
00563 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer))
00564 ;
00565 do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(
00566 integer));
00567 do_fio(&c__1, (char *)&c__7, (ftnlen)sizeof(
00568 integer));
00569 do_fio(&c__1, (char *)&result[6], (ftnlen)sizeof(
00570 real));
00571 e_wsfe();
00572 ++nfail;
00573 }
00574 ++nrun;
00575
00576 }
00577 L60:
00578 ;
00579 }
00580
00581 }
00582 L80:
00583 ;
00584 }
00585
00586
00587
00588 for (imat = 11; imat <= 18; ++imat) {
00589
00590
00591
00592 if (! dotype[imat]) {
00593 goto L110;
00594 }
00595
00596 for (iuplo = 1; iuplo <= 2; ++iuplo) {
00597
00598
00599
00600 *(unsigned char *)uplo = *(unsigned char *)&uplos[iuplo - 1];
00601 for (itran = 1; itran <= 3; ++itran) {
00602
00603
00604
00605 *(unsigned char *)trans = *(unsigned char *)&transs[itran
00606 - 1];
00607
00608
00609
00610 s_copy(srnamc_1.srnamt, "CLATTR", (ftnlen)32, (ftnlen)6);
00611 clattr_(&imat, uplo, trans, diag, iseed, &n, &a[1], &lda,
00612 &x[1], &work[1], &rwork[1], &info);
00613
00614
00615
00616
00617 s_copy(srnamc_1.srnamt, "CLATRS", (ftnlen)32, (ftnlen)6);
00618 ccopy_(&n, &x[1], &c__1, &b[1], &c__1);
00619 clatrs_(uplo, trans, diag, "N", &n, &a[1], &lda, &b[1], &
00620 scale, &rwork[1], &info);
00621
00622
00623
00624 if (info != 0) {
00625
00626 i__6[0] = 1, a__3[0] = uplo;
00627 i__6[1] = 1, a__3[1] = trans;
00628 i__6[2] = 1, a__3[2] = diag;
00629 i__6[3] = 1, a__3[3] = "N";
00630 s_cat(ch__3, a__3, i__6, &c__4, (ftnlen)4);
00631 alaerh_(path, "CLATRS", &info, &c__0, ch__3, &n, &n, &
00632 c_n1, &c_n1, &c_n1, &imat, &nfail, &nerrs,
00633 nout);
00634 }
00635
00636 ctrt03_(uplo, trans, diag, &n, &c__1, &a[1], &lda, &scale,
00637 &rwork[1], &c_b99, &b[1], &lda, &x[1], &lda, &
00638 work[1], &result[7]);
00639
00640
00641
00642
00643 ccopy_(&n, &x[1], &c__1, &b[n + 1], &c__1);
00644 clatrs_(uplo, trans, diag, "Y", &n, &a[1], &lda, &b[n + 1]
00645 , &scale, &rwork[1], &info);
00646
00647
00648
00649 if (info != 0) {
00650
00651 i__6[0] = 1, a__3[0] = uplo;
00652 i__6[1] = 1, a__3[1] = trans;
00653 i__6[2] = 1, a__3[2] = diag;
00654 i__6[3] = 1, a__3[3] = "Y";
00655 s_cat(ch__3, a__3, i__6, &c__4, (ftnlen)4);
00656 alaerh_(path, "CLATRS", &info, &c__0, ch__3, &n, &n, &
00657 c_n1, &c_n1, &c_n1, &imat, &nfail, &nerrs,
00658 nout);
00659 }
00660
00661 ctrt03_(uplo, trans, diag, &n, &c__1, &a[1], &lda, &scale,
00662 &rwork[1], &c_b99, &b[n + 1], &lda, &x[1], &lda,
00663 &work[1], &result[8]);
00664
00665
00666
00667
00668 if (result[7] >= *thresh) {
00669 if (nfail == 0 && nerrs == 0) {
00670 alahd_(nout, path);
00671 }
00672 io___40.ciunit = *nout;
00673 s_wsfe(&io___40);
00674 do_fio(&c__1, "CLATRS", (ftnlen)6);
00675 do_fio(&c__1, uplo, (ftnlen)1);
00676 do_fio(&c__1, trans, (ftnlen)1);
00677 do_fio(&c__1, diag, (ftnlen)1);
00678 do_fio(&c__1, "N", (ftnlen)1);
00679 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00680 do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(integer));
00681 do_fio(&c__1, (char *)&c__8, (ftnlen)sizeof(integer));
00682 do_fio(&c__1, (char *)&result[7], (ftnlen)sizeof(real)
00683 );
00684 e_wsfe();
00685 ++nfail;
00686 }
00687 if (result[8] >= *thresh) {
00688 if (nfail == 0 && nerrs == 0) {
00689 alahd_(nout, path);
00690 }
00691 io___41.ciunit = *nout;
00692 s_wsfe(&io___41);
00693 do_fio(&c__1, "CLATRS", (ftnlen)6);
00694 do_fio(&c__1, uplo, (ftnlen)1);
00695 do_fio(&c__1, trans, (ftnlen)1);
00696 do_fio(&c__1, diag, (ftnlen)1);
00697 do_fio(&c__1, "Y", (ftnlen)1);
00698 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00699 do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(integer));
00700 do_fio(&c__1, (char *)&c__9, (ftnlen)sizeof(integer));
00701 do_fio(&c__1, (char *)&result[8], (ftnlen)sizeof(real)
00702 );
00703 e_wsfe();
00704 ++nfail;
00705 }
00706 nrun += 2;
00707
00708 }
00709
00710 }
00711 L110:
00712 ;
00713 }
00714
00715 }
00716
00717
00718
00719 alasum_(path, nout, &nfail, &nrun, &nerrs);
00720
00721 return 0;
00722
00723
00724
00725 }