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__2 = 2;
00027 static integer c__4 = 4;
00028 static integer c__1 = 1;
00029
00030 int cdrvrf4_(integer *nout, integer *nn, integer *nval, real
00031 *thresh, complex *c1, complex *c2, integer *ldc, complex *crf,
00032 complex *a, integer *lda, real *s_work_clange__)
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 transs[1*2] = "N" "C";
00040
00041
00042 static char fmt_9999[] = "(1x,\002 *** Error(s) or Failure(s) while test"
00043 "ing CHFRK ***\002)";
00044 static char fmt_9997[] = "(1x,\002 Failure in \002,a5,\002, CFORM="
00045 "'\002,a1,\002',\002,\002 UPLO='\002,a1,\002',\002,\002 TRANS="
00046 "'\002,a1,\002',\002,\002 N=\002,i3,\002, K =\002,i3,\002, test"
00047 "=\002,g12.5)";
00048 static char fmt_9996[] = "(1x,\002All tests for \002,a5,\002 auxiliary r"
00049 "outine passed the \002,\002threshold (\002,i5,\002 tests run)"
00050 "\002)";
00051 static char fmt_9995[] = "(1x,a6,\002 auxiliary routine:\002,i5,\002 out"
00052 " of \002,i5,\002 tests failed to pass the threshold\002)";
00053
00054
00055 integer a_dim1, a_offset, c1_dim1, c1_offset, c2_dim1, c2_offset, i__1,
00056 i__2, i__3, i__4, i__5, i__6, i__7;
00057 real r__1;
00058 complex q__1;
00059
00060
00061 int s_copy(char *, char *, ftnlen, ftnlen);
00062 integer s_wsle(cilist *), e_wsle(void), s_wsfe(cilist *), e_wsfe(void),
00063 do_fio(integer *, char *, ftnlen);
00064
00065
00066 integer i__, j, k, n, iik, iin;
00067 real eps, beta;
00068 integer info;
00069 char uplo[1];
00070 integer nrun;
00071 real alpha;
00072 integer nfail, iseed[4];
00073 extern int cherk_(char *, char *, integer *, integer *,
00074 real *, complex *, integer *, real *, complex *, integer *), chfrk_(char *, char *, char *, integer *,
00075 integer *, real *, complex *, integer *, real *, complex *);
00076 char cform[1];
00077 integer iform;
00078 real norma, normc;
00079 char trans[1];
00080 integer iuplo;
00081 extern doublereal clange_(char *, integer *, integer *, complex *,
00082 integer *, real *);
00083 integer ialpha;
00084 extern VOID clarnd_(complex *, integer *, integer *);
00085 extern doublereal slamch_(char *), slarnd_(integer *, integer *);
00086 integer itrans;
00087 extern int ctfttr_(char *, char *, integer *, complex *,
00088 complex *, integer *, integer *), ctrttf_(char *,
00089 char *, integer *, complex *, integer *, complex *, integer *);
00090 real result[1];
00091
00092
00093 static cilist io___28 = { 0, 0, 0, 0, 0 };
00094 static cilist io___29 = { 0, 0, 0, fmt_9999, 0 };
00095 static cilist io___30 = { 0, 0, 0, fmt_9997, 0 };
00096 static cilist io___31 = { 0, 0, 0, fmt_9996, 0 };
00097 static cilist io___32 = { 0, 0, 0, fmt_9995, 0 };
00098
00099
00100
00101
00102
00103
00104
00105
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 --nval;
00170 c2_dim1 = *ldc;
00171 c2_offset = 1 + c2_dim1;
00172 c2 -= c2_offset;
00173 c1_dim1 = *ldc;
00174 c1_offset = 1 + c1_dim1;
00175 c1 -= c1_offset;
00176 --crf;
00177 a_dim1 = *lda;
00178 a_offset = 1 + a_dim1;
00179 a -= a_offset;
00180 --s_work_clange__;
00181
00182
00183
00184
00185
00186
00187
00188 nrun = 0;
00189 nfail = 0;
00190 info = 0;
00191 for (i__ = 1; i__ <= 4; ++i__) {
00192 iseed[i__ - 1] = iseedy[i__ - 1];
00193
00194 }
00195 eps = slamch_("Precision");
00196
00197 i__1 = *nn;
00198 for (iin = 1; iin <= i__1; ++iin) {
00199
00200 n = nval[iin];
00201
00202 i__2 = *nn;
00203 for (iik = 1; iik <= i__2; ++iik) {
00204
00205 k = nval[iin];
00206
00207 for (iform = 1; iform <= 2; ++iform) {
00208
00209 *(unsigned char *)cform = *(unsigned char *)&forms[iform - 1];
00210
00211 for (iuplo = 1; iuplo <= 2; ++iuplo) {
00212
00213 *(unsigned char *)uplo = *(unsigned char *)&uplos[iuplo -
00214 1];
00215
00216 for (itrans = 1; itrans <= 2; ++itrans) {
00217
00218 *(unsigned char *)trans = *(unsigned char *)&transs[
00219 itrans - 1];
00220
00221 for (ialpha = 1; ialpha <= 4; ++ialpha) {
00222
00223 if (ialpha == 1) {
00224 alpha = 0.f;
00225 beta = 0.f;
00226 } else if (ialpha == 1) {
00227 alpha = 1.f;
00228 beta = 0.f;
00229 } else if (ialpha == 1) {
00230 alpha = 0.f;
00231 beta = 1.f;
00232 } else {
00233 alpha = slarnd_(&c__2, iseed);
00234 beta = slarnd_(&c__2, iseed);
00235 }
00236
00237
00238
00239
00240
00241
00242 ++nrun;
00243
00244 if (itrans == 1) {
00245
00246
00247
00248 i__3 = k;
00249 for (j = 1; j <= i__3; ++j) {
00250 i__4 = n;
00251 for (i__ = 1; i__ <= i__4; ++i__) {
00252 i__5 = i__ + j * a_dim1;
00253 clarnd_(&q__1, &c__4, iseed);
00254 a[i__5].r = q__1.r, a[i__5].i =
00255 q__1.i;
00256 }
00257 }
00258
00259 norma = clange_("I", &n, &k, &a[a_offset],
00260 lda, &s_work_clange__[1]);
00261
00262 } else {
00263
00264
00265
00266 i__3 = n;
00267 for (j = 1; j <= i__3; ++j) {
00268 i__4 = k;
00269 for (i__ = 1; i__ <= i__4; ++i__) {
00270 i__5 = i__ + j * a_dim1;
00271 clarnd_(&q__1, &c__4, iseed);
00272 a[i__5].r = q__1.r, a[i__5].i =
00273 q__1.i;
00274 }
00275 }
00276
00277 norma = clange_("I", &k, &n, &a[a_offset],
00278 lda, &s_work_clange__[1]);
00279
00280 }
00281
00282
00283
00284
00285
00286
00287
00288 i__3 = n;
00289 for (j = 1; j <= i__3; ++j) {
00290 i__4 = n;
00291 for (i__ = 1; i__ <= i__4; ++i__) {
00292 i__5 = i__ + j * c1_dim1;
00293 clarnd_(&q__1, &c__4, iseed);
00294 c1[i__5].r = q__1.r, c1[i__5].i = q__1.i;
00295 i__5 = i__ + j * c2_dim1;
00296 i__6 = i__ + j * c1_dim1;
00297 c2[i__5].r = c1[i__6].r, c2[i__5].i = c1[
00298 i__6].i;
00299 }
00300 }
00301
00302
00303
00304
00305 normc = clange_("I", &n, &n, &c1[c1_offset], ldc,
00306 &s_work_clange__[1]);
00307
00308 s_copy(srnamc_1.srnamt, "CTRTTF", (ftnlen)32, (
00309 ftnlen)6);
00310 ctrttf_(cform, uplo, &n, &c1[c1_offset], ldc, &
00311 crf[1], &info);
00312
00313
00314
00315 s_copy(srnamc_1.srnamt, "CHERK ", (ftnlen)32, (
00316 ftnlen)6);
00317 cherk_(uplo, trans, &n, &k, &alpha, &a[a_offset],
00318 lda, &beta, &c1[c1_offset], ldc);
00319
00320
00321
00322 s_copy(srnamc_1.srnamt, "CHFRK ", (ftnlen)32, (
00323 ftnlen)6);
00324 chfrk_(cform, uplo, trans, &n, &k, &alpha, &a[
00325 a_offset], lda, &beta, &crf[1]);
00326
00327
00328
00329 s_copy(srnamc_1.srnamt, "CTFTTR", (ftnlen)32, (
00330 ftnlen)6);
00331 ctfttr_(cform, uplo, &n, &crf[1], &c2[c2_offset],
00332 ldc, &info);
00333
00334
00335
00336 i__3 = n;
00337 for (j = 1; j <= i__3; ++j) {
00338 i__4 = n;
00339 for (i__ = 1; i__ <= i__4; ++i__) {
00340 i__5 = i__ + j * c1_dim1;
00341 i__6 = i__ + j * c1_dim1;
00342 i__7 = i__ + j * c2_dim1;
00343 q__1.r = c1[i__6].r - c2[i__7].r, q__1.i =
00344 c1[i__6].i - c2[i__7].i;
00345 c1[i__5].r = q__1.r, c1[i__5].i = q__1.i;
00346 }
00347 }
00348
00349
00350
00351
00352
00353
00354 result[0] = clange_("I", &n, &n, &c1[c1_offset],
00355 ldc, &s_work_clange__[1]);
00356
00357 r__1 = dabs(alpha) * norma * norma + dabs(beta) *
00358 normc;
00359 result[0] = result[0] / dmax(r__1,1.f) / max(n,1)
00360 / eps;
00361
00362 if (result[0] >= *thresh) {
00363 if (nfail == 0) {
00364 io___28.ciunit = *nout;
00365 s_wsle(&io___28);
00366 e_wsle();
00367 io___29.ciunit = *nout;
00368 s_wsfe(&io___29);
00369 e_wsfe();
00370 }
00371 io___30.ciunit = *nout;
00372 s_wsfe(&io___30);
00373 do_fio(&c__1, "CHFRK", (ftnlen)5);
00374 do_fio(&c__1, cform, (ftnlen)1);
00375 do_fio(&c__1, uplo, (ftnlen)1);
00376 do_fio(&c__1, trans, (ftnlen)1);
00377 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(
00378 integer));
00379 do_fio(&c__1, (char *)&k, (ftnlen)sizeof(
00380 integer));
00381 do_fio(&c__1, (char *)&result[0], (ftnlen)
00382 sizeof(real));
00383 e_wsfe();
00384 ++nfail;
00385 }
00386
00387
00388 }
00389
00390 }
00391
00392 }
00393
00394 }
00395
00396 }
00397
00398 }
00399
00400
00401
00402 if (nfail == 0) {
00403 io___31.ciunit = *nout;
00404 s_wsfe(&io___31);
00405 do_fio(&c__1, "CHFRK", (ftnlen)5);
00406 do_fio(&c__1, (char *)&nrun, (ftnlen)sizeof(integer));
00407 e_wsfe();
00408 } else {
00409 io___32.ciunit = *nout;
00410 s_wsfe(&io___32);
00411 do_fio(&c__1, "CHFRK", (ftnlen)5);
00412 do_fio(&c__1, (char *)&nfail, (ftnlen)sizeof(integer));
00413 do_fio(&c__1, (char *)&nrun, (ftnlen)sizeof(integer));
00414 e_wsfe();
00415 }
00416
00417
00418 return 0;
00419
00420
00421
00422 }