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