diff options
Diffstat (limited to 'lib/correlation.h')
-rw-r--r-- | lib/correlation.h | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/correlation.h b/lib/correlation.h index b3b7d86..26c3a99 100644 --- a/lib/correlation.h +++ b/lib/correlation.h @@ -7,15 +7,13 @@ #include <fftw3.h> template <class R_t, class X_t> -double correlation_length(const state_t <R_t, X_t> *s, fftw_plan plan, double *in, double *out) { - for (v_t i = 0; i < s->nv; i++) { - in[i] = correlation_component(s->spins[i]); - } - - fftw_execute(plan); +double correlation_length(const state_t <R_t, X_t> *s) { + double total = 0; - double length = pow(out[0], 2); + for (D_t j = 0; j < s->D; j++) { + total += norm_squared(s->ReF[j]) + norm_squared(s->ImF[j]); + } - return length; + return total / s->D; } |