diff options
author | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2018-05-08 17:29:55 -0400 |
---|---|---|
committer | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2018-05-08 17:29:55 -0400 |
commit | 0ad14f44b3f2ef37765ed5b454de526b19d3ff4b (patch) | |
tree | e3de8839b24ba2c098842b23cd0708dc5d8a517a /src | |
parent | 8db4bf02f34bc9fbb201e7338bbe470f501597c3 (diff) | |
download | c++-0ad14f44b3f2ef37765ed5b454de526b19d3ff4b.tar.gz c++-0ad14f44b3f2ef37765ed5b454de526b19d3ff4b.tar.bz2 c++-0ad14f44b3f2ef37765ed5b454de526b19d3ff4b.zip |
changes
Diffstat (limited to 'src')
-rw-r--r-- | src/wolff_vector.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/wolff_vector.c b/src/wolff_vector.c index da93a15..c5ebcb5 100644 --- a/src/wolff_vector.c +++ b/src/wolff_vector.c @@ -36,13 +36,13 @@ double modulated(q_t n, double *H_info, double *x) { } double cubic(q_t n, double *H_info, double *x) { - double tmp = 0; + double v_sum = 0; for (q_t i = 0; i < n; i++) { - tmp += pow(x[i], 4); + v_sum += pow(x[i], 4); } - return - H_info[0] * tmp; + return - H_info[0] * v_sum; } double quadratic(q_t n, double *H_info, double *x) { @@ -181,8 +181,9 @@ int main(int argc, char *argv[]) { } s->M = (double *)calloc(q, sizeof(double)); - s->M[0] = 1.0 * (double)h->nv; - s->E = - ((double)h->ne) * s->J(1.0) - s->H(s->n, s->H_info, s->M); + s->M[0] = 1.0; + s->E = - ((double)h->ne) * s->J(1.0) - (double)h->nv * s->H(s->n, s->H_info, s->M); + s->M[0] *= (double)h->nv; double diff = 1e31; count_t n_runs = 0; |