blob: a18d740207861ed433965d26f527cd81dd266047 (
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
|
#pragma once
#include "types.h"
#include "ising.h"
/* The minimum definition for a group type R_t to act on a spin type X_t is
* given by the following.
*
* void init(R_t *p);
* void free_spin(R_t r);
* R_t copy(R_t r);
* X_t act(R_t r, X_t x);
* R_t act(R_t r, R_t r);
* X_t act_inverse(R_t r, X_t x);
* R_t act_inverse(R_t r, R_t r);
*
*/
class z2_t {
public:
bool x;
z2_t() : x(false) {}
z2_t(bool x) : x(x) {}
ising_t act(const ising_t& s) const {
if (x) {
return ising_t(!s.x);
} else {
return ising_t(s.x);
}
}
z2_t act(const z2_t& r) const {
if (x) {
return z2_t(!r.x);
} else {
return z2_t(r.x);
}
}
ising_t act_inverse(const ising_t& s) const {
return this->act(s);
}
z2_t act_inverse(const z2_t& r) const {
return this->act(r);
}
};
|