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__6 = 6;
00021 static integer c__10 = 10;
00022 static complex c_b43 = {1.f,0.f};
00023
00024 int cget35_(real *rmax, integer *lmax, integer *ninfo,
00025 integer *knt, integer *nin)
00026 {
00027
00028 integer i__1, i__2, i__3, i__4, i__5;
00029 real r__1, r__2;
00030 complex q__1;
00031
00032
00033 double sqrt(doublereal);
00034 integer s_rsle(cilist *), do_lio(integer *, integer *, char *, ftnlen),
00035 e_rsle(void);
00036 double c_abs(complex *);
00037 void c_div(complex *, complex *, complex *);
00038
00039
00040 complex a[100] , b[100] ,
00041 c__[100] ;
00042 integer i__, j, m, n;
00043 real vm1[3], vm2[3], dum[1], eps, res, res1;
00044 integer imla, imlb, imlc, info;
00045 complex csav[100] ;
00046 integer isgn;
00047 complex atmp[100] , btmp[100] ,
00048 ctmp[100] ;
00049 real tnrm;
00050 complex rmul;
00051 real xnrm;
00052 integer imlad;
00053 real scale;
00054 extern int cgemm_(char *, char *, integer *, integer *,
00055 integer *, complex *, complex *, integer *, complex *, integer *,
00056 complex *, complex *, integer *);
00057 char trana[1], tranb[1];
00058 extern int slabad_(real *, real *);
00059 extern doublereal clange_(char *, integer *, integer *, complex *,
00060 integer *, real *), slamch_(char *);
00061 integer itrana, itranb;
00062 real bignum, smlnum;
00063 extern int ctrsyl_(char *, char *, integer *, integer *,
00064 integer *, complex *, integer *, complex *, integer *, complex *,
00065 integer *, real *, integer *);
00066
00067
00068 static cilist io___6 = { 0, 0, 0, 0, 0 };
00069 static cilist io___10 = { 0, 0, 0, 0, 0 };
00070 static cilist io___13 = { 0, 0, 0, 0, 0 };
00071 static cilist io___15 = { 0, 0, 0, 0, 0 };
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
00129
00130
00131
00132
00133
00134
00135 eps = slamch_("P");
00136 smlnum = slamch_("S") / eps;
00137 bignum = 1.f / smlnum;
00138 slabad_(&smlnum, &bignum);
00139
00140
00141
00142 vm1[0] = sqrt(smlnum);
00143 vm1[1] = 1.f;
00144 vm1[2] = 1e6f;
00145 vm2[0] = 1.f;
00146 vm2[1] = eps * 2.f + 1.f;
00147 vm2[2] = 2.f;
00148
00149 *knt = 0;
00150 *ninfo = 0;
00151 *lmax = 0;
00152 *rmax = 0.f;
00153
00154
00155
00156 L10:
00157 io___6.ciunit = *nin;
00158 s_rsle(&io___6);
00159 do_lio(&c__3, &c__1, (char *)&m, (ftnlen)sizeof(integer));
00160 do_lio(&c__3, &c__1, (char *)&n, (ftnlen)sizeof(integer));
00161 e_rsle();
00162 if (n == 0) {
00163 return 0;
00164 }
00165 i__1 = m;
00166 for (i__ = 1; i__ <= i__1; ++i__) {
00167 io___10.ciunit = *nin;
00168 s_rsle(&io___10);
00169 i__2 = m;
00170 for (j = 1; j <= i__2; ++j) {
00171 do_lio(&c__6, &c__1, (char *)&atmp[i__ + j * 10 - 11], (ftnlen)
00172 sizeof(complex));
00173 }
00174 e_rsle();
00175
00176 }
00177 i__1 = n;
00178 for (i__ = 1; i__ <= i__1; ++i__) {
00179 io___13.ciunit = *nin;
00180 s_rsle(&io___13);
00181 i__2 = n;
00182 for (j = 1; j <= i__2; ++j) {
00183 do_lio(&c__6, &c__1, (char *)&btmp[i__ + j * 10 - 11], (ftnlen)
00184 sizeof(complex));
00185 }
00186 e_rsle();
00187
00188 }
00189 i__1 = m;
00190 for (i__ = 1; i__ <= i__1; ++i__) {
00191 io___15.ciunit = *nin;
00192 s_rsle(&io___15);
00193 i__2 = n;
00194 for (j = 1; j <= i__2; ++j) {
00195 do_lio(&c__6, &c__1, (char *)&ctmp[i__ + j * 10 - 11], (ftnlen)
00196 sizeof(complex));
00197 }
00198 e_rsle();
00199
00200 }
00201 for (imla = 1; imla <= 3; ++imla) {
00202 for (imlad = 1; imlad <= 3; ++imlad) {
00203 for (imlb = 1; imlb <= 3; ++imlb) {
00204 for (imlc = 1; imlc <= 3; ++imlc) {
00205 for (itrana = 1; itrana <= 2; ++itrana) {
00206 for (itranb = 1; itranb <= 2; ++itranb) {
00207 for (isgn = -1; isgn <= 1; isgn += 2) {
00208 if (itrana == 1) {
00209 *(unsigned char *)trana = 'N';
00210 }
00211 if (itrana == 2) {
00212 *(unsigned char *)trana = 'C';
00213 }
00214 if (itranb == 1) {
00215 *(unsigned char *)tranb = 'N';
00216 }
00217 if (itranb == 2) {
00218 *(unsigned char *)tranb = 'C';
00219 }
00220 tnrm = 0.f;
00221 i__1 = m;
00222 for (i__ = 1; i__ <= i__1; ++i__) {
00223 i__2 = m;
00224 for (j = 1; j <= i__2; ++j) {
00225 i__3 = i__ + j * 10 - 11;
00226 i__4 = i__ + j * 10 - 11;
00227 i__5 = imla - 1;
00228 q__1.r = vm1[i__5] * atmp[i__4].r,
00229 q__1.i = vm1[i__5] * atmp[
00230 i__4].i;
00231 a[i__3].r = q__1.r, a[i__3].i =
00232 q__1.i;
00233
00234 r__1 = tnrm, r__2 = c_abs(&a[i__ + j *
00235 10 - 11]);
00236 tnrm = dmax(r__1,r__2);
00237
00238 }
00239 i__2 = i__ + i__ * 10 - 11;
00240 i__3 = i__ + i__ * 10 - 11;
00241 i__4 = imlad - 1;
00242 q__1.r = vm2[i__4] * a[i__3].r, q__1.i =
00243 vm2[i__4] * a[i__3].i;
00244 a[i__2].r = q__1.r, a[i__2].i = q__1.i;
00245
00246 r__1 = tnrm, r__2 = c_abs(&a[i__ + i__ *
00247 10 - 11]);
00248 tnrm = dmax(r__1,r__2);
00249
00250 }
00251 i__1 = n;
00252 for (i__ = 1; i__ <= i__1; ++i__) {
00253 i__2 = n;
00254 for (j = 1; j <= i__2; ++j) {
00255 i__3 = i__ + j * 10 - 11;
00256 i__4 = i__ + j * 10 - 11;
00257 i__5 = imlb - 1;
00258 q__1.r = vm1[i__5] * btmp[i__4].r,
00259 q__1.i = vm1[i__5] * btmp[
00260 i__4].i;
00261 b[i__3].r = q__1.r, b[i__3].i =
00262 q__1.i;
00263
00264 r__1 = tnrm, r__2 = c_abs(&b[i__ + j *
00265 10 - 11]);
00266 tnrm = dmax(r__1,r__2);
00267
00268 }
00269
00270 }
00271 if (tnrm == 0.f) {
00272 tnrm = 1.f;
00273 }
00274 i__1 = m;
00275 for (i__ = 1; i__ <= i__1; ++i__) {
00276 i__2 = n;
00277 for (j = 1; j <= i__2; ++j) {
00278 i__3 = i__ + j * 10 - 11;
00279 i__4 = i__ + j * 10 - 11;
00280 i__5 = imlc - 1;
00281 q__1.r = vm1[i__5] * ctmp[i__4].r,
00282 q__1.i = vm1[i__5] * ctmp[
00283 i__4].i;
00284 c__[i__3].r = q__1.r, c__[i__3].i =
00285 q__1.i;
00286 i__3 = i__ + j * 10 - 11;
00287 i__4 = i__ + j * 10 - 11;
00288 csav[i__3].r = c__[i__4].r, csav[i__3]
00289 .i = c__[i__4].i;
00290
00291 }
00292
00293 }
00294 ++(*knt);
00295 ctrsyl_(trana, tranb, &isgn, &m, &n, a, &
00296 c__10, b, &c__10, c__, &c__10, &scale,
00297 &info);
00298 if (info != 0) {
00299 ++(*ninfo);
00300 }
00301 xnrm = clange_("M", &m, &n, c__, &c__10, dum);
00302 rmul.r = 1.f, rmul.i = 0.f;
00303 if (xnrm > 1.f && tnrm > 1.f) {
00304 if (xnrm > bignum / tnrm) {
00305 r__1 = dmax(xnrm,tnrm);
00306 rmul.r = r__1, rmul.i = 0.f;
00307 c_div(&q__1, &c_b43, &rmul);
00308 rmul.r = q__1.r, rmul.i = q__1.i;
00309 }
00310 }
00311 r__1 = -scale;
00312 q__1.r = r__1 * rmul.r, q__1.i = r__1 *
00313 rmul.i;
00314 cgemm_(trana, "N", &m, &n, &m, &rmul, a, &
00315 c__10, c__, &c__10, &q__1, csav, &
00316 c__10);
00317 r__1 = (real) isgn;
00318 q__1.r = r__1 * rmul.r, q__1.i = r__1 *
00319 rmul.i;
00320 cgemm_("N", tranb, &m, &n, &n, &q__1, c__, &
00321 c__10, b, &c__10, &c_b43, csav, &
00322 c__10);
00323 res1 = clange_("M", &m, &n, csav, &c__10, dum);
00324
00325 r__1 = smlnum, r__2 = smlnum * xnrm, r__1 =
00326 max(r__1,r__2), r__2 = c_abs(&rmul) *
00327 tnrm * eps * xnrm;
00328 res = res1 / dmax(r__1,r__2);
00329 if (res > *rmax) {
00330 *lmax = *knt;
00331 *rmax = res;
00332 }
00333
00334 }
00335
00336 }
00337
00338 }
00339
00340 }
00341
00342 }
00343
00344 }
00345
00346 }
00347 goto L10;
00348
00349
00350
00351 }