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__1 = 1;
00021
00022 int zget52_(logical *left, integer *n, doublecomplex *a,
00023 integer *lda, doublecomplex *b, integer *ldb, doublecomplex *e,
00024 integer *lde, doublecomplex *alpha, doublecomplex *beta,
00025 doublecomplex *work, doublereal *rwork, doublereal *result)
00026 {
00027
00028 integer a_dim1, a_offset, b_dim1, b_offset, e_dim1, e_offset, i__1, i__2,
00029 i__3;
00030 doublereal d__1, d__2, d__3, d__4, d__5, d__6;
00031 doublecomplex z__1;
00032
00033
00034 double d_imag(doublecomplex *);
00035 void d_cnjg(doublecomplex *, doublecomplex *);
00036
00037
00038 integer j;
00039 doublereal ulp;
00040 integer jvec;
00041 doublereal temp1;
00042 doublecomplex betai;
00043 doublereal scale, abmax, anorm, bnorm, enorm;
00044 char trans[1];
00045 extern int zgemv_(char *, integer *, integer *,
00046 doublecomplex *, doublecomplex *, integer *, doublecomplex *,
00047 integer *, doublecomplex *, doublecomplex *, integer *);
00048 doublecomplex acoeff, bcoeff;
00049 extern doublereal dlamch_(char *);
00050 doublecomplex alphai;
00051 doublereal alfmax, safmin;
00052 char normab[1];
00053 doublereal safmax, betmax;
00054 extern doublereal zlange_(char *, integer *, integer *, doublecomplex *,
00055 integer *, doublereal *);
00056 doublereal enrmer, errnrm;
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
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169 a_dim1 = *lda;
00170 a_offset = 1 + a_dim1;
00171 a -= a_offset;
00172 b_dim1 = *ldb;
00173 b_offset = 1 + b_dim1;
00174 b -= b_offset;
00175 e_dim1 = *lde;
00176 e_offset = 1 + e_dim1;
00177 e -= e_offset;
00178 --alpha;
00179 --beta;
00180 --work;
00181 --rwork;
00182 --result;
00183
00184
00185 result[1] = 0.;
00186 result[2] = 0.;
00187 if (*n <= 0) {
00188 return 0;
00189 }
00190
00191 safmin = dlamch_("Safe minimum");
00192 safmax = 1. / safmin;
00193 ulp = dlamch_("Epsilon") * dlamch_("Base");
00194
00195 if (*left) {
00196 *(unsigned char *)trans = 'C';
00197 *(unsigned char *)normab = 'I';
00198 } else {
00199 *(unsigned char *)trans = 'N';
00200 *(unsigned char *)normab = 'O';
00201 }
00202
00203
00204
00205
00206 d__1 = zlange_(normab, n, n, &a[a_offset], lda, &rwork[1]);
00207 anorm = max(d__1,safmin);
00208
00209 d__1 = zlange_(normab, n, n, &b[b_offset], ldb, &rwork[1]);
00210 bnorm = max(d__1,safmin);
00211
00212 d__1 = zlange_("O", n, n, &e[e_offset], lde, &rwork[1]);
00213 enorm = max(d__1,ulp);
00214 alfmax = safmax / max(1.,bnorm);
00215 betmax = safmax / max(1.,anorm);
00216
00217
00218
00219
00220 i__1 = *n;
00221 for (jvec = 1; jvec <= i__1; ++jvec) {
00222 i__2 = jvec;
00223 alphai.r = alpha[i__2].r, alphai.i = alpha[i__2].i;
00224 i__2 = jvec;
00225 betai.r = beta[i__2].r, betai.i = beta[i__2].i;
00226
00227 d__5 = (d__1 = alphai.r, abs(d__1)) + (d__2 = d_imag(&alphai), abs(
00228 d__2)), d__6 = (d__3 = betai.r, abs(d__3)) + (d__4 = d_imag(&
00229 betai), abs(d__4));
00230 abmax = max(d__5,d__6);
00231 if ((d__1 = alphai.r, abs(d__1)) + (d__2 = d_imag(&alphai), abs(d__2))
00232 > alfmax || (d__3 = betai.r, abs(d__3)) + (d__4 = d_imag(&
00233 betai), abs(d__4)) > betmax || abmax < 1.) {
00234 scale = 1. / max(abmax,safmin);
00235 z__1.r = scale * alphai.r, z__1.i = scale * alphai.i;
00236 alphai.r = z__1.r, alphai.i = z__1.i;
00237 z__1.r = scale * betai.r, z__1.i = scale * betai.i;
00238 betai.r = z__1.r, betai.i = z__1.i;
00239 }
00240
00241 d__5 = ((d__1 = alphai.r, abs(d__1)) + (d__2 = d_imag(&alphai), abs(
00242 d__2))) * bnorm, d__6 = ((d__3 = betai.r, abs(d__3)) + (d__4 =
00243 d_imag(&betai), abs(d__4))) * anorm, d__5 = max(d__5,d__6);
00244 scale = 1. / max(d__5,safmin);
00245 z__1.r = scale * betai.r, z__1.i = scale * betai.i;
00246 acoeff.r = z__1.r, acoeff.i = z__1.i;
00247 z__1.r = scale * alphai.r, z__1.i = scale * alphai.i;
00248 bcoeff.r = z__1.r, bcoeff.i = z__1.i;
00249 if (*left) {
00250 d_cnjg(&z__1, &acoeff);
00251 acoeff.r = z__1.r, acoeff.i = z__1.i;
00252 d_cnjg(&z__1, &bcoeff);
00253 bcoeff.r = z__1.r, bcoeff.i = z__1.i;
00254 }
00255 zgemv_(trans, n, n, &acoeff, &a[a_offset], lda, &e[jvec * e_dim1 + 1],
00256 &c__1, &c_b1, &work[*n * (jvec - 1) + 1], &c__1);
00257 z__1.r = -bcoeff.r, z__1.i = -bcoeff.i;
00258 zgemv_(trans, n, n, &z__1, &b[b_offset], lda, &e[jvec * e_dim1 + 1], &
00259 c__1, &c_b2, &work[*n * (jvec - 1) + 1], &c__1);
00260
00261 }
00262
00263 errnrm = zlange_("One", n, n, &work[1], n, &rwork[1]) / enorm;
00264
00265
00266
00267 result[1] = errnrm / ulp;
00268
00269
00270
00271 enrmer = 0.;
00272 i__1 = *n;
00273 for (jvec = 1; jvec <= i__1; ++jvec) {
00274 temp1 = 0.;
00275 i__2 = *n;
00276 for (j = 1; j <= i__2; ++j) {
00277
00278 i__3 = j + jvec * e_dim1;
00279 d__3 = temp1, d__4 = (d__1 = e[i__3].r, abs(d__1)) + (d__2 =
00280 d_imag(&e[j + jvec * e_dim1]), abs(d__2));
00281 temp1 = max(d__3,d__4);
00282
00283 }
00284
00285 d__1 = enrmer, d__2 = temp1 - 1.;
00286 enrmer = max(d__1,d__2);
00287
00288 }
00289
00290
00291
00292 result[2] = enrmer / ((doublereal) (*n) * ulp);
00293
00294 return 0;
00295
00296
00297
00298 }