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