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