summaryrefslogtreecommitdiff
path: root/lib/include/wolff/finite_states.hpp
blob: 4cca69ef68ffdbbb5f66ad65473e1fac2d976394 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35


#ifndef WOLFF_FINITE_STATES
#define WOLFF_FINITE_STATES

#include <cmath>
#include <array>

#include "system.hpp"

std::array<std::array<std::array<double, WOLFF_FINITE_STATES_N>, WOLFF_FINITE_STATES_N>, WOLFF_FINITE_STATES_N> finite_states_Zp;
#ifndef WOLFF_NO_FIELD
std::array<std::array<double, WOLFF_FINITE_STATES_N>, WOLFF_FINITE_STATES_N> finite_states_Bp;
#endif

template <class R_t, class X_t>
void finite_states_init(const wolff_system<R_t, X_t>& S) {
#ifndef WOLFF_NO_FIELD
  for (q_t i = 0; i < WOLFF_FINITE_STATES_N; i++) {
    for (q_t j = 0; j < WOLFF_FINITE_STATES_N; j++) {
      finite_states_Bp[i][j] = 1.0 - exp(-(S.B(finite_states_possible[i]) - S.B(finite_states_possible[j])) / S.T);
    }
  }
#endif
  for (q_t i = 0; i < WOLFF_FINITE_STATES_N; i++) {
    for (q_t j = 0; j < WOLFF_FINITE_STATES_N; j++) {
      for (q_t k = 0; k < WOLFF_FINITE_STATES_N; k++) {
        finite_states_Zp[i][j][k] = 1.0 - exp(-(S.Z(finite_states_possible[i], finite_states_possible[k]) - S.Z(finite_states_possible[j], finite_states_possible[k])) / S.T);
      }
    }
  }
}

#endif