#ifndef WOLFF_MODELS_DIHEDRAL_H #define WOLFF_MODELS_DIHEDRAL_H #include "potts.hpp" namespace wolff { template class dihedral_t { public: bool is_reflection; unsigned x; dihedral_t() : is_reflection(false), x(0) {} dihedral_t(bool x, unsigned y) : is_reflection(x), x(y) {} potts_t act(const potts_t& s) const { if (this->is_reflection) { return potts_t(((q + this->x) - s.x) % q); } else { return potts_t((this->x + s.x) % q); } } dihedral_t act(dihedral_t r) const { if (this->is_reflection) { return dihedral_t(!(r.is_reflection), ((q + this->x) - r.x) % q); } else { return dihedral_t(r.is_reflection, (this->x + r.x) % q); } } potts_t act_inverse(potts_t s) const { if (this->is_reflection) { return this->act(s); } else { return potts_t(((s.x + q) - this->x) % q); } } dihedral_t act_inverse(dihedral_t r) const { if (this->is_reflection) { return this->act(r); } else { return dihedral_t(r.is_reflection, ((r.x + q) - this->x) % q); } } }; } #endif