From b5998a15cdbab21f03a65d9885dbde39615dc087 Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Fri, 20 Jul 2018 23:21:39 -0400 Subject: cos and sin calls for computing fourier term now precomputed --- lib/cluster.h | 35 ++++++----------------------------- 1 file changed, 6 insertions(+), 29 deletions(-) (limited to 'lib/cluster.h') diff --git a/lib/cluster.h b/lib/cluster.h index 4b3c2f6..d90dc64 100644 --- a/lib/cluster.h +++ b/lib/cluster.h @@ -29,30 +29,6 @@ #include "dihinf.h" #include "yule_walker.h" -template -void init(T*); - -template -T scalar_multiple(v_t a, T b); - -template -X_t act(R_t a, X_t b); - -template -X_t act_inverse(R_t a, X_t b); - -template -T copy(T a); - -template -void free_spin(T a); - -template -T add(T, T); - -template -T subtract(T, T); - template void flip_cluster(state_t *state, v_t v0, R_t r, gsl_rng *rand) { v_t nv = 0; @@ -114,12 +90,13 @@ void flip_cluster(state_t *state, v_t v0, R_t r, gsl_rng *rand) { state->E += dE; for (D_t i = 0; i < state->D; i++) { - double x = (double)((non_ghost / (v_t)pow(state->L, state->D - i - 1)) % state->L) / (double)state->L; - add(&(state->ReF[i]), -cos(2 * M_PI * x), rs_old); - add(&(state->ReF[i]), cos(2 * M_PI * x), rs_new); + L_t x = (non_ghost / (v_t)pow(state->L, state->D - i - 1)) % state->L; + + add(&(state->ReF[i]), -state->precomputed_cos[i], rs_old); + add(&(state->ReF[i]), state->precomputed_cos[i], rs_new); - add(&(state->ImF[i]), -sin(2 * M_PI * x), rs_old); - add(&(state->ImF[i]), sin(2 * M_PI * x), rs_new); + add(&(state->ImF[i]), -state->precomputed_sin[i], rs_old); + add(&(state->ImF[i]), state->precomputed_sin[i], rs_new); } free_spin (rs_old); -- cgit v1.2.3-70-g09d2