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