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
00021 int zget51_(integer *itype, integer *n, doublecomplex *a,
00022 integer *lda, doublecomplex *b, integer *ldb, doublecomplex *u,
00023 integer *ldu, doublecomplex *v, integer *ldv, doublecomplex *work,
00024 doublereal *rwork, doublereal *result)
00025 {
00026
00027 integer a_dim1, a_offset, b_dim1, b_offset, u_dim1, u_offset, v_dim1,
00028 v_offset, i__1, i__2, i__3, i__4, i__5;
00029 doublereal d__1, d__2;
00030 doublecomplex z__1;
00031
00032
00033 doublereal ulp;
00034 integer jcol;
00035 doublereal unfl;
00036 integer jrow, jdiag;
00037 doublereal anorm;
00038 extern int zgemm_(char *, char *, integer *, integer *,
00039 integer *, doublecomplex *, doublecomplex *, integer *,
00040 doublecomplex *, integer *, doublecomplex *, doublecomplex *,
00041 integer *);
00042 doublereal wnorm;
00043 extern doublereal dlamch_(char *), zlange_(char *, integer *,
00044 integer *, doublecomplex *, integer *, doublereal *);
00045 extern int zlacpy_(char *, integer *, integer *,
00046 doublecomplex *, integer *, doublecomplex *, integer *);
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
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 a_dim1 = *lda;
00149 a_offset = 1 + a_dim1;
00150 a -= a_offset;
00151 b_dim1 = *ldb;
00152 b_offset = 1 + b_dim1;
00153 b -= b_offset;
00154 u_dim1 = *ldu;
00155 u_offset = 1 + u_dim1;
00156 u -= u_offset;
00157 v_dim1 = *ldv;
00158 v_offset = 1 + v_dim1;
00159 v -= v_offset;
00160 --work;
00161 --rwork;
00162
00163
00164 *result = 0.;
00165 if (*n <= 0) {
00166 return 0;
00167 }
00168
00169
00170
00171 unfl = dlamch_("Safe minimum");
00172 ulp = dlamch_("Epsilon") * dlamch_("Base");
00173
00174
00175
00176 if (*itype < 1 || *itype > 3) {
00177 *result = 10. / ulp;
00178 return 0;
00179 }
00180
00181 if (*itype <= 2) {
00182
00183
00184
00185
00186 d__1 = zlange_("1", n, n, &a[a_offset], lda, &rwork[1]);
00187 anorm = max(d__1,unfl);
00188
00189 if (*itype == 1) {
00190
00191
00192
00193 zlacpy_(" ", n, n, &a[a_offset], lda, &work[1], n);
00194
00195 i__1 = *n;
00196 zgemm_("N", "N", n, n, n, &c_b2, &u[u_offset], ldu, &b[b_offset],
00197 ldb, &c_b1, &work[i__1 * i__1 + 1], n);
00198
00199 z__1.r = -1., z__1.i = -0.;
00200
00201 i__1 = *n;
00202 zgemm_("N", "C", n, n, n, &z__1, &work[i__1 * i__1 + 1], n, &v[
00203 v_offset], ldv, &c_b2, &work[1], n);
00204
00205 } else {
00206
00207
00208
00209 zlacpy_(" ", n, n, &b[b_offset], ldb, &work[1], n);
00210
00211 i__1 = *n;
00212 for (jcol = 1; jcol <= i__1; ++jcol) {
00213 i__2 = *n;
00214 for (jrow = 1; jrow <= i__2; ++jrow) {
00215 i__3 = jrow + *n * (jcol - 1);
00216 i__4 = jrow + *n * (jcol - 1);
00217 i__5 = jrow + jcol * a_dim1;
00218 z__1.r = work[i__4].r - a[i__5].r, z__1.i = work[i__4].i
00219 - a[i__5].i;
00220 work[i__3].r = z__1.r, work[i__3].i = z__1.i;
00221
00222 }
00223
00224 }
00225 }
00226
00227
00228
00229 wnorm = zlange_("1", n, n, &work[1], n, &rwork[1]);
00230
00231 if (anorm > wnorm) {
00232 *result = wnorm / anorm / (*n * ulp);
00233 } else {
00234 if (anorm < 1.) {
00235
00236 d__1 = wnorm, d__2 = *n * anorm;
00237 *result = min(d__1,d__2) / anorm / (*n * ulp);
00238 } else {
00239
00240 d__1 = wnorm / anorm, d__2 = (doublereal) (*n);
00241 *result = min(d__1,d__2) / (*n * ulp);
00242 }
00243 }
00244
00245 } else {
00246
00247
00248
00249
00250
00251 zgemm_("N", "C", n, n, n, &c_b2, &u[u_offset], ldu, &u[u_offset], ldu,
00252 &c_b1, &work[1], n);
00253
00254 i__1 = *n;
00255 for (jdiag = 1; jdiag <= i__1; ++jdiag) {
00256 i__2 = (*n + 1) * (jdiag - 1) + 1;
00257 i__3 = (*n + 1) * (jdiag - 1) + 1;
00258 z__1.r = work[i__3].r - 1., z__1.i = work[i__3].i - 0.;
00259 work[i__2].r = z__1.r, work[i__2].i = z__1.i;
00260
00261 }
00262
00263
00264 d__1 = zlange_("1", n, n, &work[1], n, &rwork[1]), d__2 = (
00265 doublereal) (*n);
00266 *result = min(d__1,d__2) / (*n * ulp);
00267 }
00268
00269 return 0;
00270
00271
00272
00273 }