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 integer infot, iounit;
00020 logical ok, lerr;
00021 } infoc_;
00022
00023 #define infoc_1 infoc_
00024
00025 struct {
00026 char srnamt[32];
00027 } srnamc_;
00028
00029 #define srnamc_1 srnamc_
00030
00031
00032
00033 static doublereal c_b11 = 0.;
00034 static doublereal c_b16 = 1.;
00035 static integer c__1 = 1;
00036
00037 int dchkqp_(logical *dotype, integer *nm, integer *mval,
00038 integer *nn, integer *nval, doublereal *thresh, logical *tsterr,
00039 doublereal *a, doublereal *copya, doublereal *s, doublereal *copys,
00040 doublereal *tau, doublereal *work, integer *iwork, integer *nout)
00041 {
00042
00043
00044 static integer iseedy[4] = { 1988,1989,1990,1991 };
00045
00046
00047 static char fmt_9999[] = "(\002 M =\002,i5,\002, N =\002,i5,\002, type"
00048 " \002,i2,\002, test \002,i2,\002, ratio =\002,g12.5)";
00049
00050
00051 integer i__1, i__2, i__3, i__4;
00052 doublereal d__1;
00053
00054
00055 int s_copy(char *, char *, ftnlen, ftnlen);
00056 integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
00057
00058
00059 integer i__, k, m, n, im, in, lda;
00060 doublereal eps;
00061 integer mode, info;
00062 char path[3];
00063 integer ilow, nrun;
00064 extern int alahd_(integer *, char *);
00065 integer ihigh, nfail, iseed[4], imode;
00066 extern doublereal dqpt01_(integer *, integer *, integer *, doublereal *,
00067 doublereal *, integer *, doublereal *, integer *, doublereal *,
00068 integer *), dqrt11_(integer *, integer *, doublereal *, integer *,
00069 doublereal *, doublereal *, integer *), dqrt12_(integer *,
00070 integer *, doublereal *, integer *, doublereal *, doublereal *,
00071 integer *);
00072 integer mnmin, istep, nerrs, lwork;
00073 extern doublereal dlamch_(char *);
00074 extern int dlaord_(char *, integer *, doublereal *,
00075 integer *), dgeqpf_(integer *, integer *, doublereal *,
00076 integer *, integer *, doublereal *, doublereal *, integer *),
00077 dlacpy_(char *, integer *, integer *, doublereal *, integer *,
00078 doublereal *, integer *), dlaset_(char *, integer *,
00079 integer *, doublereal *, doublereal *, doublereal *, integer *), alasum_(char *, integer *, integer *, integer *, integer
00080 *), dlatms_(integer *, integer *, char *, integer *, char
00081 *, doublereal *, integer *, doublereal *, doublereal *, integer *,
00082 integer *, char *, doublereal *, integer *, doublereal *,
00083 integer *), derrqp_(char *, integer *);
00084 doublereal result[3];
00085
00086
00087 static cilist io___24 = { 0, 0, 0, fmt_9999, 0 };
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
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
00170
00171
00172
00173
00174
00175 --iwork;
00176 --work;
00177 --tau;
00178 --copys;
00179 --s;
00180 --copya;
00181 --a;
00182 --nval;
00183 --mval;
00184 --dotype;
00185
00186
00187
00188
00189
00190
00191
00192 s_copy(path, "Double precision", (ftnlen)1, (ftnlen)16);
00193 s_copy(path + 1, "QP", (ftnlen)2, (ftnlen)2);
00194 nrun = 0;
00195 nfail = 0;
00196 nerrs = 0;
00197 for (i__ = 1; i__ <= 4; ++i__) {
00198 iseed[i__ - 1] = iseedy[i__ - 1];
00199
00200 }
00201 eps = dlamch_("Epsilon");
00202
00203
00204
00205 if (*tsterr) {
00206 derrqp_(path, nout);
00207 }
00208 infoc_1.infot = 0;
00209
00210 i__1 = *nm;
00211 for (im = 1; im <= i__1; ++im) {
00212
00213
00214
00215 m = mval[im];
00216 lda = max(1,m);
00217
00218 i__2 = *nn;
00219 for (in = 1; in <= i__2; ++in) {
00220
00221
00222
00223 n = nval[in];
00224 mnmin = min(m,n);
00225
00226 i__3 = 1, i__4 = m * max(m,n) + (mnmin << 2) + max(m,n), i__3 =
00227 max(i__3,i__4), i__4 = m * n + (mnmin << 1) + (n << 2);
00228 lwork = max(i__3,i__4);
00229
00230 for (imode = 1; imode <= 6; ++imode) {
00231 if (! dotype[imode]) {
00232 goto L60;
00233 }
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243 mode = imode;
00244 if (imode > 3) {
00245 mode = 1;
00246 }
00247
00248
00249
00250
00251 i__3 = n;
00252 for (i__ = 1; i__ <= i__3; ++i__) {
00253 iwork[i__] = 0;
00254
00255 }
00256 if (imode == 1) {
00257 dlaset_("Full", &m, &n, &c_b11, &c_b11, ©a[1], &lda);
00258 i__3 = mnmin;
00259 for (i__ = 1; i__ <= i__3; ++i__) {
00260 copys[i__] = 0.;
00261
00262 }
00263 } else {
00264 d__1 = 1. / eps;
00265 dlatms_(&m, &n, "Uniform", iseed, "Nonsymm", ©s[1], &
00266 mode, &d__1, &c_b16, &m, &n, "No packing", ©a[
00267 1], &lda, &work[1], &info);
00268 if (imode >= 4) {
00269 if (imode == 4) {
00270 ilow = 1;
00271 istep = 1;
00272
00273 i__3 = 1, i__4 = n / 2;
00274 ihigh = max(i__3,i__4);
00275 } else if (imode == 5) {
00276
00277 i__3 = 1, i__4 = n / 2;
00278 ilow = max(i__3,i__4);
00279 istep = 1;
00280 ihigh = n;
00281 } else if (imode == 6) {
00282 ilow = 1;
00283 istep = 2;
00284 ihigh = n;
00285 }
00286 i__3 = ihigh;
00287 i__4 = istep;
00288 for (i__ = ilow; i__4 < 0 ? i__ >= i__3 : i__ <= i__3;
00289 i__ += i__4) {
00290 iwork[i__] = 1;
00291
00292 }
00293 }
00294 dlaord_("Decreasing", &mnmin, ©s[1], &c__1);
00295 }
00296
00297
00298
00299 dlacpy_("All", &m, &n, ©a[1], &lda, &a[1], &lda);
00300
00301
00302
00303 s_copy(srnamc_1.srnamt, "DGEQPF", (ftnlen)32, (ftnlen)6);
00304 dgeqpf_(&m, &n, &a[1], &lda, &iwork[1], &tau[1], &work[1], &
00305 info);
00306
00307
00308
00309 result[0] = dqrt12_(&m, &n, &a[1], &lda, ©s[1], &work[1],
00310 &lwork);
00311
00312
00313
00314 result[1] = dqpt01_(&m, &n, &mnmin, ©a[1], &a[1], &lda, &
00315 tau[1], &iwork[1], &work[1], &lwork);
00316
00317
00318
00319 result[2] = dqrt11_(&m, &mnmin, &a[1], &lda, &tau[1], &work[1]
00320 , &lwork);
00321
00322
00323
00324
00325 for (k = 1; k <= 3; ++k) {
00326 if (result[k - 1] >= *thresh) {
00327 if (nfail == 0 && nerrs == 0) {
00328 alahd_(nout, path);
00329 }
00330 io___24.ciunit = *nout;
00331 s_wsfe(&io___24);
00332 do_fio(&c__1, (char *)&m, (ftnlen)sizeof(integer));
00333 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00334 do_fio(&c__1, (char *)&imode, (ftnlen)sizeof(integer))
00335 ;
00336 do_fio(&c__1, (char *)&k, (ftnlen)sizeof(integer));
00337 do_fio(&c__1, (char *)&result[k - 1], (ftnlen)sizeof(
00338 doublereal));
00339 e_wsfe();
00340 ++nfail;
00341 }
00342
00343 }
00344 nrun += 3;
00345 L60:
00346 ;
00347 }
00348
00349 }
00350
00351 }
00352
00353
00354
00355 alasum_(path, nout, &nfail, &nrun, &nerrs);
00356
00357
00358
00359
00360 return 0;
00361 }