replace Rel with tuple

This commit is contained in:
David Allemang
2022-09-14 21:37:34 -04:00
parent 27a3231cfe
commit 89c216dfe4
5 changed files with 23 additions and 35 deletions

View File

@@ -10,7 +10,5 @@
#include "group.hpp"
namespace tc {
using Coset = unsigned int;
Cosets solve(const Group &group, const std::vector<Coset> &sub_gens);
}

View File

@@ -5,6 +5,12 @@
#include "cosets.hpp"
namespace tc {
using Coset = uint32_t;
using Gen = uint16_t;
using Mult = uint16_t;
using Rel = std::tuple<Gen, Gen, Mult>;
struct Cosets {
int ngens;
std::vector<int> data;

View File

@@ -23,11 +23,12 @@ namespace tc {
}
void set(const Rel &r) {
_mults(r.gens[0], r.gens[1]) = r.mult;
auto &[i, j, m] = r;
_mults(i, j) = m;
}
[[nodiscard]] int get(int a, int b) const {
return _mults(a, b);
[[nodiscard]] int get(int i, int j) const {
return _mults(i, j);
}
[[nodiscard]] std::vector<Rel> rels() const {

View File

@@ -100,21 +100,4 @@ namespace tc {
return path.size();
}
};
struct Rel {
std::array<int, 2> gens;
int mult;
Rel() = default;
Rel(const Rel &) = default;
Rel(int a, int b, int m)
: gens({a, b}), mult(m) {
}
[[nodiscard]] Rel shift(int off) const {
return Rel(gens[0] + off, gens[1] + off, mult);
}
};
}