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