mirror of
https://github.com/allemangD/toddcox-visualize.git
synced 2025-11-10 12:02:47 -05:00
replace Rel with tuple
This commit is contained in:
@@ -10,7 +10,5 @@
|
||||
#include "group.hpp"
|
||||
|
||||
namespace tc {
|
||||
using Coset = unsigned int;
|
||||
|
||||
Cosets solve(const Group &group, const std::vector<Coset> &sub_gens);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user