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