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__3 = 3;
00019 static integer c__1 = 1;
00020 static integer c__5 = 5;
00021 static integer c__10 = 10;
00022 static doublereal c_b21 = 0.;
00023 static doublereal c_b22 = 1.;
00024 static integer c__200 = 200;
00025
00026 int dget36_(doublereal *rmax, integer *lmax, integer *ninfo,
00027 integer *knt, integer *nin)
00028 {
00029
00030 integer i__1, i__2;
00031
00032
00033 integer s_rsle(cilist *), do_lio(integer *, integer *, char *, ftnlen),
00034 e_rsle(void);
00035 double d_sign(doublereal *, doublereal *);
00036
00037
00038 integer i__, j, n;
00039 doublereal q[100] , t1[100] ,
00040 t2[100] ;
00041 integer loc;
00042 doublereal eps, res, tmp[100] ;
00043 integer ifst, ilst;
00044 doublereal work[200];
00045 integer info1, info2, ifst1, ifst2, ilst1, ilst2;
00046 extern int dhst01_(integer *, integer *, integer *,
00047 doublereal *, integer *, doublereal *, integer *, doublereal *,
00048 integer *, doublereal *, integer *, doublereal *);
00049 extern doublereal dlamch_(char *);
00050 extern int dlacpy_(char *, integer *, integer *,
00051 doublereal *, integer *, doublereal *, integer *),
00052 dlaset_(char *, integer *, integer *, doublereal *, doublereal *,
00053 doublereal *, integer *), dtrexc_(char *, integer *,
00054 doublereal *, integer *, doublereal *, integer *, integer *,
00055 integer *, doublereal *, integer *);
00056 integer ifstsv;
00057 doublereal result[2];
00058 integer ilstsv;
00059
00060
00061 static cilist io___2 = { 0, 0, 0, 0, 0 };
00062 static cilist io___7 = { 0, 0, 0, 0, 0 };
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
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 --ninfo;
00129
00130
00131 eps = dlamch_("P");
00132 *rmax = 0.;
00133 *lmax = 0;
00134 *knt = 0;
00135 ninfo[1] = 0;
00136 ninfo[2] = 0;
00137 ninfo[3] = 0;
00138
00139
00140
00141 L10:
00142 io___2.ciunit = *nin;
00143 s_rsle(&io___2);
00144 do_lio(&c__3, &c__1, (char *)&n, (ftnlen)sizeof(integer));
00145 do_lio(&c__3, &c__1, (char *)&ifst, (ftnlen)sizeof(integer));
00146 do_lio(&c__3, &c__1, (char *)&ilst, (ftnlen)sizeof(integer));
00147 e_rsle();
00148 if (n == 0) {
00149 return 0;
00150 }
00151 ++(*knt);
00152 i__1 = n;
00153 for (i__ = 1; i__ <= i__1; ++i__) {
00154 io___7.ciunit = *nin;
00155 s_rsle(&io___7);
00156 i__2 = n;
00157 for (j = 1; j <= i__2; ++j) {
00158 do_lio(&c__5, &c__1, (char *)&tmp[i__ + j * 10 - 11], (ftnlen)
00159 sizeof(doublereal));
00160 }
00161 e_rsle();
00162
00163 }
00164 dlacpy_("F", &n, &n, tmp, &c__10, t1, &c__10);
00165 dlacpy_("F", &n, &n, tmp, &c__10, t2, &c__10);
00166 ifstsv = ifst;
00167 ilstsv = ilst;
00168 ifst1 = ifst;
00169 ilst1 = ilst;
00170 ifst2 = ifst;
00171 ilst2 = ilst;
00172 res = 0.;
00173
00174
00175
00176 dlaset_("Full", &n, &n, &c_b21, &c_b22, q, &c__10);
00177 dtrexc_("N", &n, t1, &c__10, q, &c__10, &ifst1, &ilst1, work, &info1);
00178 i__1 = n;
00179 for (i__ = 1; i__ <= i__1; ++i__) {
00180 i__2 = n;
00181 for (j = 1; j <= i__2; ++j) {
00182 if (i__ == j && q[i__ + j * 10 - 11] != 1.) {
00183 res += 1. / eps;
00184 }
00185 if (i__ != j && q[i__ + j * 10 - 11] != 0.) {
00186 res += 1. / eps;
00187 }
00188
00189 }
00190
00191 }
00192
00193
00194
00195 dlaset_("Full", &n, &n, &c_b21, &c_b22, q, &c__10);
00196 dtrexc_("V", &n, t2, &c__10, q, &c__10, &ifst2, &ilst2, work, &info2);
00197
00198
00199
00200 i__1 = n;
00201 for (i__ = 1; i__ <= i__1; ++i__) {
00202 i__2 = n;
00203 for (j = 1; j <= i__2; ++j) {
00204 if (t1[i__ + j * 10 - 11] != t2[i__ + j * 10 - 11]) {
00205 res += 1. / eps;
00206 }
00207
00208 }
00209
00210 }
00211 if (ifst1 != ifst2) {
00212 res += 1. / eps;
00213 }
00214 if (ilst1 != ilst2) {
00215 res += 1. / eps;
00216 }
00217 if (info1 != info2) {
00218 res += 1. / eps;
00219 }
00220
00221
00222
00223 if (info2 != 0) {
00224 ++ninfo[info2];
00225 } else {
00226 if ((i__1 = ifst2 - ifstsv, abs(i__1)) > 1) {
00227 res += 1. / eps;
00228 }
00229 if ((i__1 = ilst2 - ilstsv, abs(i__1)) > 1) {
00230 res += 1. / eps;
00231 }
00232 }
00233
00234
00235
00236 dhst01_(&n, &c__1, &n, tmp, &c__10, t2, &c__10, q, &c__10, work, &c__200,
00237 result);
00238 res = res + result[0] + result[1];
00239
00240
00241
00242 loc = 1;
00243 L70:
00244 if (t2[loc + 1 + loc * 10 - 11] != 0.) {
00245
00246
00247
00248 if (t2[loc + (loc + 1) * 10 - 11] == 0. || t2[loc + loc * 10 - 11] !=
00249 t2[loc + 1 + (loc + 1) * 10 - 11] || d_sign(&c_b22, &t2[loc +
00250 (loc + 1) * 10 - 11]) == d_sign(&c_b22, &t2[loc + 1 + loc *
00251 10 - 11])) {
00252 res += 1. / eps;
00253 }
00254 i__1 = n;
00255 for (i__ = loc + 2; i__ <= i__1; ++i__) {
00256 if (t2[i__ + loc * 10 - 11] != 0.) {
00257 res += 1. / res;
00258 }
00259 if (t2[i__ + (loc + 1) * 10 - 11] != 0.) {
00260 res += 1. / res;
00261 }
00262
00263 }
00264 loc += 2;
00265 } else {
00266
00267
00268
00269 i__1 = n;
00270 for (i__ = loc + 1; i__ <= i__1; ++i__) {
00271 if (t2[i__ + loc * 10 - 11] != 0.) {
00272 res += 1. / res;
00273 }
00274
00275 }
00276 ++loc;
00277 }
00278 if (loc < n) {
00279 goto L70;
00280 }
00281 if (res > *rmax) {
00282 *rmax = res;
00283 *lmax = *knt;
00284 }
00285 goto L10;
00286
00287
00288
00289 }