diff options
author | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2018-07-19 13:39:01 -0400 |
---|---|---|
committer | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2018-07-19 13:39:01 -0400 |
commit | ffa58d427cd0e8b4e6ebd5538a83bec63a85ab27 (patch) | |
tree | 932d9f0bb71ee2ba3edda2fb8b7572b6e82da142 /lib/correlation.h | |
parent | 07bfd781266868ee6bac8e2b58f9675b3536354d (diff) | |
download | c++-ffa58d427cd0e8b4e6ebd5538a83bec63a85ab27.tar.gz c++-ffa58d427cd0e8b4e6ebd5538a83bec63a85ab27.tar.bz2 c++-ffa58d427cd0e8b4e6ebd5538a83bec63a85ab27.zip |
new mesaurement flag system, fftw only initialized once, all O(n) models now built from one file with different compiler flag settings
Diffstat (limited to 'lib/correlation.h')
-rw-r--r-- | lib/correlation.h | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/lib/correlation.h b/lib/correlation.h index 5722aab..b3b7d86 100644 --- a/lib/correlation.h +++ b/lib/correlation.h @@ -7,29 +7,14 @@ #include <fftw3.h> template <class R_t, class X_t> -double correlation_length(const state_t <R_t, X_t> *s) { - double *data = (double *)fftw_malloc(s->nv * sizeof(double)); - int rank = s->D; - int *n = (int *)malloc(rank * sizeof(int)); - fftw_r2r_kind *kind = (fftw_r2r_kind *)malloc(rank * sizeof(fftw_r2r_kind)); - for (D_t i = 0; i < rank; i++) { - n[i] = s->L; - kind[i] = FFTW_R2HC; - } - fftw_plan plan = fftw_plan_r2r(rank, n, data, data, kind, 0); - +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++) { - data[i] = correlation_component(s->spins[i]); + in[i] = correlation_component(s->spins[i]); } fftw_execute(plan); - double length = pow(data[0], 2); - - fftw_destroy_plan(plan); - fftw_free(data); - free(n); - free(kind); + double length = pow(out[0], 2); return length; } |