blob: dd56134e7873f0c4820db63b9331af2770bd0cb9 (
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
 | 
#ifndef WOLFF_MODELS_POTTS_H
#define WOLFF_MODELS_POTTS_H
#include <cmath>
#include "vector.hpp"
namespace wolff {
  template <unsigned q>
  class potts_t {
    public:
      unsigned x;
      potts_t() : x(0) {}
      potts_t(unsigned x) : x(x) {}
      typedef vector_t<q, int> M_t;
      typedef vector_t<q, double> F_t;
      inline vector_t<q, int> operator*(unsigned a) const {
        vector_t<q, int> result;
        result.fill(0);
        result[x] = (int)a;
        return result;
      }
      inline vector_t<q, double> operator*(double a) const {
        vector_t<q, double> result;
        result.fill(0.0);
        result[x] = a;
        return result;
      }
      inline vector_t<q, int> operator-(const potts_t<q> &s) const {
        vector_t<q, int> result;
        result.fill(0);
        result[x]++;
        result[s.x]--;
        return result;
      }
      unsigned enumerate() const {
        return x;
      }
  };
  template<unsigned q>
  inline typename potts_t<q>::M_t operator*(unsigned a, const potts_t<q>& s) {
    return s * a;
  }
  template<unsigned q>
  inline typename potts_t<q>::F_t operator*(double a, const potts_t<q>& s) {
    return s * a;
  }
}
#endif
 |