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 integer c__1 = 1;
00019 static doublereal c_b13 = -1.;
00020 static doublereal c_b15 = 1.;
00021
00022 int dglmts_(integer *n, integer *m, integer *p, doublereal *
00023 a, doublereal *af, integer *lda, doublereal *b, doublereal *bf,
00024 integer *ldb, doublereal *d__, doublereal *df, doublereal *x,
00025 doublereal *u, doublereal *work, integer *lwork, doublereal *rwork,
00026 doublereal *result)
00027 {
00028
00029 integer a_dim1, a_offset, af_dim1, af_offset, b_dim1, b_offset, bf_dim1,
00030 bf_offset;
00031 doublereal d__1;
00032
00033
00034 doublereal eps;
00035 integer info;
00036 doublereal unfl;
00037 extern int dgemv_(char *, integer *, integer *,
00038 doublereal *, doublereal *, integer *, doublereal *, integer *,
00039 doublereal *, doublereal *, integer *);
00040 extern doublereal dasum_(integer *, doublereal *, integer *);
00041 doublereal anorm, bnorm;
00042 extern int dcopy_(integer *, doublereal *, integer *,
00043 doublereal *, integer *);
00044 doublereal dnorm, xnorm, ynorm;
00045 extern doublereal dlamch_(char *), dlange_(char *, integer *,
00046 integer *, doublereal *, integer *, doublereal *);
00047 extern int dggglm_(integer *, integer *, integer *,
00048 doublereal *, integer *, doublereal *, integer *, doublereal *,
00049 doublereal *, doublereal *, doublereal *, integer *, integer *),
00050 dlacpy_(char *, integer *, integer *, doublereal *, integer *,
00051 doublereal *, integer *);
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 af_dim1 = *lda;
00138 af_offset = 1 + af_dim1;
00139 af -= af_offset;
00140 a_dim1 = *lda;
00141 a_offset = 1 + a_dim1;
00142 a -= a_offset;
00143 bf_dim1 = *ldb;
00144 bf_offset = 1 + bf_dim1;
00145 bf -= bf_offset;
00146 b_dim1 = *ldb;
00147 b_offset = 1 + b_dim1;
00148 b -= b_offset;
00149 --d__;
00150 --df;
00151 --x;
00152 --u;
00153 --work;
00154 --rwork;
00155
00156
00157 eps = dlamch_("Epsilon");
00158 unfl = dlamch_("Safe minimum");
00159
00160 d__1 = dlange_("1", n, m, &a[a_offset], lda, &rwork[1]);
00161 anorm = max(d__1,unfl);
00162
00163 d__1 = dlange_("1", n, p, &b[b_offset], ldb, &rwork[1]);
00164 bnorm = max(d__1,unfl);
00165
00166
00167
00168
00169 dlacpy_("Full", n, m, &a[a_offset], lda, &af[af_offset], lda);
00170 dlacpy_("Full", n, p, &b[b_offset], ldb, &bf[bf_offset], ldb);
00171 dcopy_(n, &d__[1], &c__1, &df[1], &c__1);
00172
00173
00174
00175 dggglm_(n, m, p, &af[af_offset], lda, &bf[bf_offset], ldb, &df[1], &x[1],
00176 &u[1], &work[1], lwork, &info);
00177
00178
00179
00180
00181
00182
00183
00184 dcopy_(n, &d__[1], &c__1, &df[1], &c__1);
00185 dgemv_("No transpose", n, m, &c_b13, &a[a_offset], lda, &x[1], &c__1, &
00186 c_b15, &df[1], &c__1);
00187
00188 dgemv_("No transpose", n, p, &c_b13, &b[b_offset], ldb, &u[1], &c__1, &
00189 c_b15, &df[1], &c__1);
00190
00191 dnorm = dasum_(n, &df[1], &c__1);
00192 xnorm = dasum_(m, &x[1], &c__1) + dasum_(p, &u[1], &c__1);
00193 ynorm = anorm + bnorm;
00194
00195 if (xnorm <= 0.) {
00196 *result = 0.;
00197 } else {
00198 *result = dnorm / ynorm / xnorm / eps;
00199 }
00200
00201 return 0;
00202
00203
00204
00205 }