00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "f2c.h"
00014 #include "blaswrap.h"
00015
00016 int sget53_(real *a, integer *lda, real *b, integer *ldb,
00017 real *scale, real *wr, real *wi, real *result, integer *info)
00018 {
00019
00020 integer a_dim1, a_offset, b_dim1, b_offset;
00021 real r__1, r__2, r__3, r__4, r__5, r__6;
00022
00023
00024 double sqrt(doublereal);
00025
00026
00027 real s1, ci11, ci12, ci22, cr11, cr12, cr21, cr22, ulp, wis, wrs, deti,
00028 absw, detr, temp, anorm, bnorm, cnorm, cscale;
00029 extern doublereal slamch_(char *);
00030 real scales, safmin, sigmin;
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
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 a_dim1 = *lda;
00120 a_offset = 1 + a_dim1;
00121 a -= a_offset;
00122 b_dim1 = *ldb;
00123 b_offset = 1 + b_dim1;
00124 b -= b_offset;
00125
00126
00127 *info = 0;
00128 *result = 0.f;
00129 scales = *scale;
00130 wrs = *wr;
00131 wis = *wi;
00132
00133
00134
00135 safmin = slamch_("Safe minimum");
00136 ulp = slamch_("Epsilon") * slamch_("Base");
00137 absw = dabs(wrs) + dabs(wis);
00138
00139 r__5 = (r__1 = a[a_dim1 + 1], dabs(r__1)) + (r__2 = a[a_dim1 + 2], dabs(
00140 r__2)), r__6 = (r__3 = a[(a_dim1 << 1) + 1], dabs(r__3)) + (r__4 =
00141 a[(a_dim1 << 1) + 2], dabs(r__4)), r__5 = max(r__5,r__6);
00142 anorm = dmax(r__5,safmin);
00143
00144 r__4 = (r__3 = b[b_dim1 + 1], dabs(r__3)), r__5 = (r__1 = b[(b_dim1 << 1)
00145 + 1], dabs(r__1)) + (r__2 = b[(b_dim1 << 1) + 2], dabs(r__2)),
00146 r__4 = max(r__4,r__5);
00147 bnorm = dmax(r__4,safmin);
00148
00149
00150
00151 temp = safmin * bnorm * absw + safmin * anorm * scales;
00152 if (temp >= 1.f) {
00153
00154
00155
00156 *info = 1;
00157 temp = 1.f / temp;
00158 scales *= temp;
00159 wrs *= temp;
00160 wis *= temp;
00161 absw = dabs(wrs) + dabs(wis);
00162 }
00163
00164
00165 r__3 = scales * anorm, r__4 = absw * bnorm;
00166 r__1 = ulp * dmax(r__3,r__4), r__2 = safmin * dmax(scales,absw);
00167 s1 = dmax(r__1,r__2);
00168
00169
00170
00171 if (s1 < safmin) {
00172 *info = 2;
00173 if (scales < safmin && absw < safmin) {
00174 *info = 3;
00175 *result = 1.f / ulp;
00176 return 0;
00177 }
00178
00179
00180
00181
00182 r__1 = scales * anorm + absw * bnorm;
00183 temp = 1.f / dmax(r__1,safmin);
00184 scales *= temp;
00185 wrs *= temp;
00186 wis *= temp;
00187 absw = dabs(wrs) + dabs(wis);
00188
00189
00190 r__3 = scales * anorm, r__4 = absw * bnorm;
00191 r__1 = ulp * dmax(r__3,r__4), r__2 = safmin * dmax(scales,absw);
00192 s1 = dmax(r__1,r__2);
00193 if (s1 < safmin) {
00194 *info = 3;
00195 *result = 1.f / ulp;
00196 return 0;
00197 }
00198 }
00199
00200
00201
00202 cr11 = scales * a[a_dim1 + 1] - wrs * b[b_dim1 + 1];
00203 ci11 = -wis * b[b_dim1 + 1];
00204 cr21 = scales * a[a_dim1 + 2];
00205 cr12 = scales * a[(a_dim1 << 1) + 1] - wrs * b[(b_dim1 << 1) + 1];
00206 ci12 = -wis * b[(b_dim1 << 1) + 1];
00207 cr22 = scales * a[(a_dim1 << 1) + 2] - wrs * b[(b_dim1 << 1) + 2];
00208 ci22 = -wis * b[(b_dim1 << 1) + 2];
00209
00210
00211
00212
00213
00214
00215
00216
00217 r__1 = dabs(cr11) + dabs(ci11) + dabs(cr21), r__2 = dabs(cr12) + dabs(
00218 ci12) + dabs(cr22) + dabs(ci22), r__1 = max(r__1,r__2);
00219 cnorm = dmax(r__1,safmin);
00220 cscale = 1.f / sqrt(cnorm);
00221 detr = cscale * cr11 * (cscale * cr22) - cscale * ci11 * (cscale * ci22)
00222 - cscale * cr12 * (cscale * cr21);
00223 deti = cscale * cr11 * (cscale * ci22) + cscale * ci11 * (cscale * cr22)
00224 - cscale * ci12 * (cscale * cr21);
00225 sigmin = dabs(detr) + dabs(deti);
00226 *result = sigmin / s1;
00227 return 0;
00228
00229
00230
00231 }