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