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