00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "f2c.h"
00014 #include "blaswrap.h"
00015
00016
00017
00018 static integer c__8 = 8;
00019 static integer c__1 = 1;
00020 static integer c__2 = 2;
00021 static integer c__0 = 0;
00022
00023 int zckglm_(integer *nn, integer *nval, integer *mval,
00024 integer *pval, integer *nmats, integer *iseed, doublereal *thresh,
00025 integer *nmax, doublecomplex *a, doublecomplex *af, doublecomplex *b,
00026 doublecomplex *bf, doublecomplex *x, doublecomplex *work, doublereal *
00027 rwork, integer *nin, integer *nout, integer *info)
00028 {
00029
00030 static char fmt_9997[] = "(\002 *** Invalid input for GLM: M = \002,"
00031 "i6,\002, P = \002,i6,\002, N = \002,i6,\002;\002,/\002 must "
00032 "satisfy M <= N <= M+P \002,\002(this set of values will be skip"
00033 "ped)\002)";
00034 static char fmt_9999[] = "(\002 ZLATMS in ZCKGLM INFO = \002,i5)";
00035 static char fmt_9998[] = "(\002 N=\002,i4,\002 M=\002,i4,\002, P=\002,"
00036 "i4,\002, type \002,i2,\002, test \002,i2,\002, ratio=\002,g13.6)";
00037
00038
00039 integer i__1, i__2, i__3;
00040 doublecomplex z__1;
00041
00042
00043 int s_copy(char *, char *, ftnlen, ftnlen);
00044 integer s_wsle(cilist *), e_wsle(void), s_wsfe(cilist *), do_fio(integer *
00045 , char *, ftnlen), e_wsfe(void);
00046
00047
00048 integer i__, m, n, p, ik, lda, ldb, kla, klb, kua, kub, imat;
00049 char path[3], type__[1];
00050 integer nrun, modea, modeb, nfail;
00051 char dista[1], distb[1];
00052 integer iinfo;
00053 doublereal resid, anorm, bnorm;
00054 integer lwork;
00055 extern int dlatb9_(char *, integer *, integer *, integer
00056 *, integer *, char *, integer *, integer *, integer *, integer *,
00057 doublereal *, doublereal *, integer *, integer *, doublereal *,
00058 doublereal *, char *, char *),
00059 alahdg_(integer *, char *);
00060 doublereal cndnma, cndnmb;
00061 extern int alareq_(char *, integer *, logical *, integer
00062 *, integer *, integer *), alasum_(char *, integer *,
00063 integer *, integer *, integer *);
00064 extern VOID zlarnd_(doublecomplex *, integer *,
00065 integer *);
00066 logical dotype[8];
00067 extern int zlatms_(integer *, integer *, char *, integer
00068 *, char *, doublereal *, integer *, doublereal *, doublereal *,
00069 integer *, integer *, char *, doublecomplex *, integer *,
00070 doublecomplex *, integer *);
00071 logical firstt;
00072 extern int zglmts_(integer *, integer *, integer *,
00073 doublecomplex *, doublecomplex *, integer *, doublecomplex *,
00074 doublecomplex *, integer *, doublecomplex *, doublecomplex *,
00075 doublecomplex *, doublecomplex *, doublecomplex *, integer *,
00076 doublereal *, doublereal *);
00077
00078
00079 static cilist io___13 = { 0, 0, 0, 0, 0 };
00080 static cilist io___14 = { 0, 0, 0, fmt_9997, 0 };
00081 static cilist io___30 = { 0, 0, 0, fmt_9999, 0 };
00082 static cilist io___31 = { 0, 0, 0, fmt_9999, 0 };
00083 static cilist io___34 = { 0, 0, 0, fmt_9998, 0 };
00084
00085
00086
00087
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
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185 --rwork;
00186 --work;
00187 --x;
00188 --bf;
00189 --b;
00190 --af;
00191 --a;
00192 --iseed;
00193 --pval;
00194 --mval;
00195 --nval;
00196
00197
00198 s_copy(path, "GLM", (ftnlen)3, (ftnlen)3);
00199 *info = 0;
00200 nrun = 0;
00201 nfail = 0;
00202 firstt = TRUE_;
00203 alareq_(path, nmats, dotype, &c__8, nin, nout);
00204 lda = *nmax;
00205 ldb = *nmax;
00206 lwork = *nmax * *nmax;
00207
00208
00209
00210 i__1 = *nn;
00211 for (ik = 1; ik <= i__1; ++ik) {
00212 m = mval[ik];
00213 p = pval[ik];
00214 n = nval[ik];
00215 if (m > n || n > m + p) {
00216 if (firstt) {
00217 io___13.ciunit = *nout;
00218 s_wsle(&io___13);
00219 e_wsle();
00220 firstt = FALSE_;
00221 }
00222 io___14.ciunit = *nout;
00223 s_wsfe(&io___14);
00224 do_fio(&c__1, (char *)&m, (ftnlen)sizeof(integer));
00225 do_fio(&c__1, (char *)&p, (ftnlen)sizeof(integer));
00226 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00227 e_wsfe();
00228 }
00229
00230 }
00231 firstt = TRUE_;
00232
00233
00234
00235 i__1 = *nn;
00236 for (ik = 1; ik <= i__1; ++ik) {
00237 m = mval[ik];
00238 p = pval[ik];
00239 n = nval[ik];
00240 if (m > n || n > m + p) {
00241 goto L40;
00242 }
00243
00244 for (imat = 1; imat <= 8; ++imat) {
00245
00246
00247
00248 if (! dotype[imat - 1]) {
00249 goto L30;
00250 }
00251
00252
00253
00254
00255 dlatb9_(path, &imat, &m, &p, &n, type__, &kla, &kua, &klb, &kub, &
00256 anorm, &bnorm, &modea, &modeb, &cndnma, &cndnmb, dista,
00257 distb);
00258
00259 zlatms_(&n, &m, dista, &iseed[1], type__, &rwork[1], &modea, &
00260 cndnma, &anorm, &kla, &kua, "No packing", &a[1], &lda, &
00261 work[1], &iinfo);
00262 if (iinfo != 0) {
00263 io___30.ciunit = *nout;
00264 s_wsfe(&io___30);
00265 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
00266 e_wsfe();
00267 *info = abs(iinfo);
00268 goto L30;
00269 }
00270
00271 zlatms_(&n, &p, distb, &iseed[1], type__, &rwork[1], &modeb, &
00272 cndnmb, &bnorm, &klb, &kub, "No packing", &b[1], &ldb, &
00273 work[1], &iinfo);
00274 if (iinfo != 0) {
00275 io___31.ciunit = *nout;
00276 s_wsfe(&io___31);
00277 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
00278 e_wsfe();
00279 *info = abs(iinfo);
00280 goto L30;
00281 }
00282
00283
00284
00285 i__2 = n;
00286 for (i__ = 1; i__ <= i__2; ++i__) {
00287 i__3 = i__;
00288 zlarnd_(&z__1, &c__2, &iseed[1]);
00289 x[i__3].r = z__1.r, x[i__3].i = z__1.i;
00290
00291 }
00292
00293 zglmts_(&n, &m, &p, &a[1], &af[1], &lda, &b[1], &bf[1], &ldb, &x[
00294 1], &x[*nmax + 1], &x[(*nmax << 1) + 1], &x[*nmax * 3 + 1]
00295 , &work[1], &lwork, &rwork[1], &resid);
00296
00297
00298
00299
00300 if (resid >= *thresh) {
00301 if (nfail == 0 && firstt) {
00302 firstt = FALSE_;
00303 alahdg_(nout, path);
00304 }
00305 io___34.ciunit = *nout;
00306 s_wsfe(&io___34);
00307 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00308 do_fio(&c__1, (char *)&m, (ftnlen)sizeof(integer));
00309 do_fio(&c__1, (char *)&p, (ftnlen)sizeof(integer));
00310 do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(integer));
00311 do_fio(&c__1, (char *)&c__1, (ftnlen)sizeof(integer));
00312 do_fio(&c__1, (char *)&resid, (ftnlen)sizeof(doublereal));
00313 e_wsfe();
00314 ++nfail;
00315 }
00316 ++nrun;
00317
00318 L30:
00319 ;
00320 }
00321 L40:
00322 ;
00323 }
00324
00325
00326
00327 alasum_(path, nout, &nfail, &nrun, &c__0);
00328
00329 return 0;
00330
00331
00332
00333 }