summaryrefslogtreecommitdiff
path: root/examples/include/correlation.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/include/correlation.hpp')
-rw-r--r--examples/include/correlation.hpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/examples/include/correlation.hpp b/examples/include/correlation.hpp
new file mode 100644
index 0000000..042cff3
--- /dev/null
+++ b/examples/include/correlation.hpp
@@ -0,0 +1,23 @@
+
+#pragma once
+
+#include <wolff/types.h>
+#include <wolff/state.hpp>
+
+#include <fftw3.h>
+
+template <class R_t, class X_t>
+double correlation_length(const state_t <R_t, X_t>& s) {
+ double total = 0;
+
+#ifdef DIMENSION
+ for (D_t j = 0; j < DIMENSION; j++) {
+#else
+ for (D_t j = 0; j < s.D; j++) {
+#endif
+ total += norm_squared(s.ReF[j]) + norm_squared(s.ImF[j]);
+ }
+
+ return total / s.D;
+}
+