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 char srnamt[32];
00020 } srnamc_;
00021
00022 #define srnamc_1 srnamc_
00023
00024
00025
00026 static integer c__4 = 4;
00027 static integer c__5 = 5;
00028 static integer c__1 = 1;
00029
00030 int cdrvrf3_(integer *nout, integer *nn, integer *nval, real
00031 *thresh, complex *a, integer *lda, complex *arf, complex *b1, complex
00032 *b2, real *s_work_clange__, complex *c_work_cgeqrf__, complex *tau)
00033 {
00034
00035
00036 static integer iseedy[4] = { 1988,1989,1990,1991 };
00037 static char uplos[1*2] = "U" "L";
00038 static char forms[1*2] = "N" "C";
00039 static char sides[1*2] = "L" "R";
00040 static char transs[1*2] = "N" "C";
00041 static char diags[1*2] = "N" "U";
00042
00043
00044 static char fmt_9999[] = "(1x,\002 *** Error(s) or Failure(s) while test"
00045 "ing CTFSM ***\002)";
00046 static char fmt_9997[] = "(1x,\002 Failure in \002,a5,\002, CFORM="
00047 "'\002,a1,\002',\002,\002 SIDE='\002,a1,\002',\002,\002 UPLO='"
00048 "\002,a1,\002',\002,\002 TRANS='\002,a1,\002',\002,\002 DIAG='"
00049 "\002,a1,\002',\002,\002 M=\002,i3,\002, N =\002,i3,\002, test"
00050 "=\002,g12.5)";
00051 static char fmt_9996[] = "(1x,\002All tests for \002,a5,\002 auxiliary r"
00052 "outine passed the \002,\002threshold (\002,i5,\002 tests run)"
00053 "\002)";
00054 static char fmt_9995[] = "(1x,a6,\002 auxiliary routine:\002,i5,\002 out"
00055 " of \002,i5,\002 tests failed to pass the threshold\002)";
00056
00057
00058 integer a_dim1, a_offset, b1_dim1, b1_offset, b2_dim1, b2_offset, i__1,
00059 i__2, i__3, i__4, i__5, i__6, i__7;
00060 complex q__1, q__2;
00061
00062
00063 int s_copy(char *, char *, ftnlen, ftnlen);
00064 double sqrt(doublereal);
00065 integer s_wsle(cilist *), e_wsle(void), s_wsfe(cilist *), e_wsfe(void),
00066 do_fio(integer *, char *, ftnlen);
00067
00068
00069 integer i__, j, m, n, na, iim, iin;
00070 real eps;
00071 char diag[1], side[1];
00072 integer info;
00073 char uplo[1];
00074 integer nrun, idiag;
00075 complex alpha;
00076 integer nfail, iseed[4], iside;
00077 char cform[1];
00078 integer iform;
00079 extern int ctfsm_(char *, char *, char *, char *, char *,
00080 integer *, integer *, complex *, complex *, complex *, integer *);
00081 char trans[1];
00082 integer iuplo;
00083 extern int ctrsm_(char *, char *, char *, char *,
00084 integer *, integer *, complex *, complex *, integer *, complex *,
00085 integer *);
00086 extern doublereal clange_(char *, integer *, integer *, complex *,
00087 integer *, real *);
00088 integer ialpha;
00089 extern int cgelqf_(integer *, integer *, complex *,
00090 integer *, complex *, complex *, integer *, integer *);
00091 extern VOID clarnd_(complex *, integer *, integer *);
00092 extern doublereal slamch_(char *);
00093 extern int cgeqrf_(integer *, integer *, complex *,
00094 integer *, complex *, complex *, integer *, integer *);
00095 integer itrans;
00096 extern int ctrttf_(char *, char *, integer *, complex *,
00097 integer *, complex *, integer *);
00098 real result[1];
00099
00100
00101 static cilist io___32 = { 0, 0, 0, 0, 0 };
00102 static cilist io___33 = { 0, 0, 0, fmt_9999, 0 };
00103 static cilist io___34 = { 0, 0, 0, fmt_9997, 0 };
00104 static cilist io___35 = { 0, 0, 0, fmt_9996, 0 };
00105 static cilist io___36 = { 0, 0, 0, fmt_9995, 0 };
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
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 --nval;
00179 b2_dim1 = *lda;
00180 b2_offset = 1 + b2_dim1;
00181 b2 -= b2_offset;
00182 b1_dim1 = *lda;
00183 b1_offset = 1 + b1_dim1;
00184 b1 -= b1_offset;
00185 a_dim1 = *lda;
00186 a_offset = 1 + a_dim1;
00187 a -= a_offset;
00188 --arf;
00189 --s_work_clange__;
00190 --c_work_cgeqrf__;
00191 --tau;
00192
00193
00194
00195
00196
00197
00198
00199 nrun = 0;
00200 nfail = 0;
00201 info = 0;
00202 for (i__ = 1; i__ <= 4; ++i__) {
00203 iseed[i__ - 1] = iseedy[i__ - 1];
00204
00205 }
00206 eps = slamch_("Precision");
00207
00208 i__1 = *nn;
00209 for (iim = 1; iim <= i__1; ++iim) {
00210
00211 m = nval[iim];
00212
00213 i__2 = *nn;
00214 for (iin = 1; iin <= i__2; ++iin) {
00215
00216 n = nval[iin];
00217
00218 for (iform = 1; iform <= 2; ++iform) {
00219
00220 *(unsigned char *)cform = *(unsigned char *)&forms[iform - 1];
00221
00222 for (iuplo = 1; iuplo <= 2; ++iuplo) {
00223
00224 *(unsigned char *)uplo = *(unsigned char *)&uplos[iuplo -
00225 1];
00226
00227 for (iside = 1; iside <= 2; ++iside) {
00228
00229 *(unsigned char *)side = *(unsigned char *)&sides[
00230 iside - 1];
00231
00232 for (itrans = 1; itrans <= 2; ++itrans) {
00233
00234 *(unsigned char *)trans = *(unsigned char *)&
00235 transs[itrans - 1];
00236
00237 for (idiag = 1; idiag <= 2; ++idiag) {
00238
00239 *(unsigned char *)diag = *(unsigned char *)&
00240 diags[idiag - 1];
00241
00242 for (ialpha = 1; ialpha <= 3; ++ialpha) {
00243
00244 if (ialpha == 1) {
00245 alpha.r = 0.f, alpha.i = 0.f;
00246 } else if (ialpha == 1) {
00247 alpha.r = 1.f, alpha.i = 0.f;
00248 } else {
00249 clarnd_(&q__1, &c__4, iseed);
00250 alpha.r = q__1.r, alpha.i = q__1.i;
00251 }
00252
00253
00254
00255
00256
00257
00258 ++nrun;
00259
00260 if (iside == 1) {
00261
00262
00263
00264
00265 na = m;
00266
00267 } else {
00268
00269
00270
00271
00272 na = n;
00273
00274 }
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284 i__3 = na;
00285 for (j = 1; j <= i__3; ++j) {
00286 i__4 = na;
00287 for (i__ = 1; i__ <= i__4; ++i__) {
00288 i__5 = i__ + j * a_dim1;
00289 clarnd_(&q__1, &c__4, iseed);
00290 a[i__5].r = q__1.r, a[i__5].i =
00291 q__1.i;
00292 }
00293 }
00294
00295 if (iuplo == 1) {
00296
00297
00298
00299
00300 s_copy(srnamc_1.srnamt, "CGEQRF", (
00301 ftnlen)32, (ftnlen)6);
00302 cgeqrf_(&na, &na, &a[a_offset], lda, &
00303 tau[1], &c_work_cgeqrf__[1],
00304 lda, &info);
00305 } else {
00306
00307
00308
00309
00310 s_copy(srnamc_1.srnamt, "CGELQF", (
00311 ftnlen)32, (ftnlen)6);
00312 cgelqf_(&na, &na, &a[a_offset], lda, &
00313 tau[1], &c_work_cgeqrf__[1],
00314 lda, &info);
00315 }
00316
00317
00318
00319
00320
00321
00322 i__3 = na;
00323 for (j = 1; j <= i__3; ++j) {
00324 i__4 = j + j * a_dim1;
00325 i__5 = j + j * a_dim1;
00326 clarnd_(&q__2, &c__5, iseed);
00327 q__1.r = a[i__5].r * q__2.r - a[i__5]
00328 .i * q__2.i, q__1.i = a[i__5]
00329 .r * q__2.i + a[i__5].i *
00330 q__2.r;
00331 a[i__4].r = q__1.r, a[i__4].i =
00332 q__1.i;
00333 }
00334
00335
00336
00337 s_copy(srnamc_1.srnamt, "CTRTTF", (ftnlen)
00338 32, (ftnlen)6);
00339 ctrttf_(cform, uplo, &na, &a[a_offset],
00340 lda, &arf[1], &info);
00341
00342
00343
00344
00345 i__3 = n;
00346 for (j = 1; j <= i__3; ++j) {
00347 i__4 = m;
00348 for (i__ = 1; i__ <= i__4; ++i__) {
00349 i__5 = i__ + j * b1_dim1;
00350 clarnd_(&q__1, &c__4, iseed);
00351 b1[i__5].r = q__1.r, b1[i__5].i =
00352 q__1.i;
00353 i__5 = i__ + j * b2_dim1;
00354 i__6 = i__ + j * b1_dim1;
00355 b2[i__5].r = b1[i__6].r, b2[i__5]
00356 .i = b1[i__6].i;
00357 }
00358 }
00359
00360
00361
00362
00363 s_copy(srnamc_1.srnamt, "CTRSM", (ftnlen)
00364 32, (ftnlen)5);
00365 ctrsm_(side, uplo, trans, diag, &m, &n, &
00366 alpha, &a[a_offset], lda, &b1[
00367 b1_offset], lda);
00368
00369
00370
00371
00372 s_copy(srnamc_1.srnamt, "CTFSM", (ftnlen)
00373 32, (ftnlen)5);
00374 ctfsm_(cform, side, uplo, trans, diag, &m,
00375 &n, &alpha, &arf[1], &b2[
00376 b2_offset], lda);
00377
00378
00379
00380 i__3 = n;
00381 for (j = 1; j <= i__3; ++j) {
00382 i__4 = m;
00383 for (i__ = 1; i__ <= i__4; ++i__) {
00384 i__5 = i__ + j * b1_dim1;
00385 i__6 = i__ + j * b2_dim1;
00386 i__7 = i__ + j * b1_dim1;
00387 q__1.r = b2[i__6].r - b1[i__7].r,
00388 q__1.i = b2[i__6].i - b1[
00389 i__7].i;
00390 b1[i__5].r = q__1.r, b1[i__5].i =
00391 q__1.i;
00392 }
00393 }
00394
00395 result[0] = clange_("I", &m, &n, &b1[
00396 b1_offset], lda, &s_work_clange__[
00397 1]);
00398
00399
00400 i__3 = max(m,n);
00401 result[0] = result[0] / sqrt(eps) / max(
00402 i__3,1);
00403
00404 if (result[0] >= *thresh) {
00405 if (nfail == 0) {
00406 io___32.ciunit = *nout;
00407 s_wsle(&io___32);
00408 e_wsle();
00409 io___33.ciunit = *nout;
00410 s_wsfe(&io___33);
00411 e_wsfe();
00412 }
00413 io___34.ciunit = *nout;
00414 s_wsfe(&io___34);
00415 do_fio(&c__1, "CTFSM", (ftnlen)5);
00416 do_fio(&c__1, cform, (ftnlen)1);
00417 do_fio(&c__1, side, (ftnlen)1);
00418 do_fio(&c__1, uplo, (ftnlen)1);
00419 do_fio(&c__1, trans, (ftnlen)1);
00420 do_fio(&c__1, diag, (ftnlen)1);
00421 do_fio(&c__1, (char *)&m, (ftnlen)
00422 sizeof(integer));
00423 do_fio(&c__1, (char *)&n, (ftnlen)
00424 sizeof(integer));
00425 do_fio(&c__1, (char *)&result[0], (
00426 ftnlen)sizeof(real));
00427 e_wsfe();
00428 ++nfail;
00429 }
00430
00431
00432 }
00433
00434 }
00435
00436 }
00437
00438 }
00439
00440 }
00441
00442 }
00443
00444 }
00445
00446 }
00447
00448
00449
00450 if (nfail == 0) {
00451 io___35.ciunit = *nout;
00452 s_wsfe(&io___35);
00453 do_fio(&c__1, "CTFSM", (ftnlen)5);
00454 do_fio(&c__1, (char *)&nrun, (ftnlen)sizeof(integer));
00455 e_wsfe();
00456 } else {
00457 io___36.ciunit = *nout;
00458 s_wsfe(&io___36);
00459 do_fio(&c__1, "CTFSM", (ftnlen)5);
00460 do_fio(&c__1, (char *)&nfail, (ftnlen)sizeof(integer));
00461 do_fio(&c__1, (char *)&nrun, (ftnlen)sizeof(integer));
00462 e_wsfe();
00463 }
00464
00465
00466 return 0;
00467
00468
00469
00470 }