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