diff options
author | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2018-06-26 15:13:46 -0400 |
---|---|---|
committer | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2018-06-26 15:13:46 -0400 |
commit | 25781a4041fa75a3394949d111be3abbefc97c26 (patch) | |
tree | 60e9db774c2257a045efabf50aea13d850d8c265 /lib/symmetric.c | |
parent | 7ee46e45abea3261b2728aa4d0f03f939e123dc7 (diff) | |
download | c++-25781a4041fa75a3394949d111be3abbefc97c26.tar.gz c++-25781a4041fa75a3394949d111be3abbefc97c26.tar.bz2 c++-25781a4041fa75a3394949d111be3abbefc97c26.zip |
began generalizing the potts code to work with all finite spin spaces
Diffstat (limited to 'lib/symmetric.c')
-rw-r--r-- | lib/symmetric.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/symmetric.c b/lib/symmetric.c new file mode 100644 index 0000000..729b38c --- /dev/null +++ b/lib/symmetric.c @@ -0,0 +1,27 @@ + +#include "symmetric.h" + +q_t *symmetric_compose(q_t q, const q_t *g1, const q_t *g2) { + q_t *g3 = (q_t *)malloc(q * sizeof(q_t)); + + for (q_t i = 0; i < q; i++) { + g3[i] = g1[g2[i]]; + } + + return g3; +} + +q_t symmetric_act(const q_t *g, q_t s) { + return g[s]; +} + +q_t *symmetric_invert(q_t q, const q_t *g) { + q_t *g_inv = (q_t *)malloc(q * sizeof(q_t)); + + for (q_t i = 0; i < q; i++) { + g_inv[g[i]] = i; + } + + return g_inv; +} + |