summaryrefslogtreecommitdiff
path: root/examples/include/correlation.hpp
blob: 042cff3a52e551cdd01bcab050bee9e1391a8ece (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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;
}