diff options
author | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2018-07-19 18:22:15 -0400 |
---|---|---|
committer | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2018-07-19 18:22:15 -0400 |
commit | 72301b3d5c3a91ff2e7fc6eedcad7bce8e647efa (patch) | |
tree | 0927a2de8f92970b1499250e6cae4335a989b70f /lib/correlation.h | |
parent | d63eaab6d7c414d6a66e00e061919220d5b039e0 (diff) | |
download | c++-72301b3d5c3a91ff2e7fc6eedcad7bce8e647efa.tar.gz c++-72301b3d5c3a91ff2e7fc6eedcad7bce8e647efa.tar.bz2 c++-72301b3d5c3a91ff2e7fc6eedcad7bce8e647efa.zip |
efficient computation of the smallest fourier mode by doing a magnetization-style update anytime a bond with the external field changes
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; } |