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 complex c_b1 = {0.f,0.f};
00019 static complex c_b2 = {1.f,0.f};
00020 static integer c__3 = 3;
00021 static integer c__1 = 1;
00022 static integer c__6 = 6;
00023 static integer c__10 = 10;
00024 static integer c__11 = 11;
00025 static integer c__200 = 200;
00026
00027 int cget36_(real *rmax, integer *lmax, integer *ninfo,
00028 integer *knt, integer *nin)
00029 {
00030
00031 integer i__1, i__2, i__3, i__4;
00032
00033
00034 integer s_rsle(cilist *), do_lio(integer *, integer *, char *, ftnlen),
00035 e_rsle(void);
00036
00037
00038 integer i__, j, n;
00039 complex q[100] , t1[100] ,
00040 t2[100] ;
00041 real eps, res;
00042 complex tmp[100] , diag[10];
00043 integer ifst, ilst;
00044 complex work[200];
00045 integer info1, info2;
00046 extern int chst01_(integer *, integer *, integer *,
00047 complex *, integer *, complex *, integer *, complex *, integer *,
00048 complex *, integer *, real *, real *);
00049 complex ctemp;
00050 extern int ccopy_(integer *, complex *, integer *,
00051 complex *, integer *);
00052 real rwork[10];
00053 extern doublereal slamch_(char *);
00054 extern int clacpy_(char *, integer *, integer *, complex
00055 *, integer *, complex *, integer *), claset_(char *,
00056 integer *, integer *, complex *, complex *, complex *, integer *), ctrexc_(char *, integer *, complex *, integer *, complex
00057 *, integer *, integer *, integer *, integer *);
00058 real result[2];
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 eps = slamch_("P");
00124 *rmax = 0.f;
00125 *lmax = 0;
00126 *knt = 0;
00127 *ninfo = 0;
00128
00129
00130
00131 L10:
00132 io___2.ciunit = *nin;
00133 s_rsle(&io___2);
00134 do_lio(&c__3, &c__1, (char *)&n, (ftnlen)sizeof(integer));
00135 do_lio(&c__3, &c__1, (char *)&ifst, (ftnlen)sizeof(integer));
00136 do_lio(&c__3, &c__1, (char *)&ilst, (ftnlen)sizeof(integer));
00137 e_rsle();
00138 if (n == 0) {
00139 return 0;
00140 }
00141 ++(*knt);
00142 i__1 = n;
00143 for (i__ = 1; i__ <= i__1; ++i__) {
00144 io___7.ciunit = *nin;
00145 s_rsle(&io___7);
00146 i__2 = n;
00147 for (j = 1; j <= i__2; ++j) {
00148 do_lio(&c__6, &c__1, (char *)&tmp[i__ + j * 10 - 11], (ftnlen)
00149 sizeof(complex));
00150 }
00151 e_rsle();
00152
00153 }
00154 clacpy_("F", &n, &n, tmp, &c__10, t1, &c__10);
00155 clacpy_("F", &n, &n, tmp, &c__10, t2, &c__10);
00156 res = 0.f;
00157
00158
00159
00160 claset_("Full", &n, &n, &c_b1, &c_b2, q, &c__10);
00161 ctrexc_("N", &n, t1, &c__10, q, &c__10, &ifst, &ilst, &info1);
00162 i__1 = n;
00163 for (i__ = 1; i__ <= i__1; ++i__) {
00164 i__2 = n;
00165 for (j = 1; j <= i__2; ++j) {
00166 i__3 = i__ + j * 10 - 11;
00167 if (i__ == j && (q[i__3].r != 1.f || q[i__3].i != 0.f)) {
00168 res += 1.f / eps;
00169 }
00170 i__3 = i__ + j * 10 - 11;
00171 if (i__ != j && (q[i__3].r != 0.f || q[i__3].i != 0.f)) {
00172 res += 1.f / eps;
00173 }
00174
00175 }
00176
00177 }
00178
00179
00180
00181 claset_("Full", &n, &n, &c_b1, &c_b2, q, &c__10);
00182 ctrexc_("V", &n, t2, &c__10, q, &c__10, &ifst, &ilst, &info2);
00183
00184
00185
00186 i__1 = n;
00187 for (i__ = 1; i__ <= i__1; ++i__) {
00188 i__2 = n;
00189 for (j = 1; j <= i__2; ++j) {
00190 i__3 = i__ + j * 10 - 11;
00191 i__4 = i__ + j * 10 - 11;
00192 if (t1[i__3].r != t2[i__4].r || t1[i__3].i != t2[i__4].i) {
00193 res += 1.f / eps;
00194 }
00195
00196 }
00197
00198 }
00199 if (info1 != 0 || info2 != 0) {
00200 ++(*ninfo);
00201 }
00202 if (info1 != info2) {
00203 res += 1.f / eps;
00204 }
00205
00206
00207
00208 ccopy_(&n, tmp, &c__11, diag, &c__1);
00209 if (ifst < ilst) {
00210 i__1 = ilst;
00211 for (i__ = ifst + 1; i__ <= i__1; ++i__) {
00212 i__2 = i__ - 1;
00213 ctemp.r = diag[i__2].r, ctemp.i = diag[i__2].i;
00214 i__2 = i__ - 1;
00215 i__3 = i__ - 2;
00216 diag[i__2].r = diag[i__3].r, diag[i__2].i = diag[i__3].i;
00217 i__2 = i__ - 2;
00218 diag[i__2].r = ctemp.r, diag[i__2].i = ctemp.i;
00219
00220 }
00221 } else if (ifst > ilst) {
00222 i__1 = ilst;
00223 for (i__ = ifst - 1; i__ >= i__1; --i__) {
00224 i__2 = i__;
00225 ctemp.r = diag[i__2].r, ctemp.i = diag[i__2].i;
00226 i__2 = i__;
00227 i__3 = i__ - 1;
00228 diag[i__2].r = diag[i__3].r, diag[i__2].i = diag[i__3].i;
00229 i__2 = i__ - 1;
00230 diag[i__2].r = ctemp.r, diag[i__2].i = ctemp.i;
00231
00232 }
00233 }
00234 i__1 = n;
00235 for (i__ = 1; i__ <= i__1; ++i__) {
00236 i__2 = i__ + i__ * 10 - 11;
00237 i__3 = i__ - 1;
00238 if (t2[i__2].r != diag[i__3].r || t2[i__2].i != diag[i__3].i) {
00239 res += 1.f / eps;
00240 }
00241
00242 }
00243
00244
00245
00246 chst01_(&n, &c__1, &n, tmp, &c__10, t2, &c__10, q, &c__10, work, &c__200,
00247 rwork, result);
00248 res = res + result[0] + result[1];
00249
00250
00251
00252 i__1 = n - 1;
00253 for (j = 1; j <= i__1; ++j) {
00254 i__2 = n;
00255 for (i__ = j + 1; i__ <= i__2; ++i__) {
00256 i__3 = i__ + j * 10 - 11;
00257 if (t2[i__3].r != 0.f || t2[i__3].i != 0.f) {
00258 res += 1.f / eps;
00259 }
00260
00261 }
00262
00263 }
00264 if (res > *rmax) {
00265 *rmax = res;
00266 *lmax = *knt;
00267 }
00268 goto L10;
00269
00270
00271
00272 }