1
0

add subgroup

This commit is contained in:
2020-01-07 23:06:48 -05:00
parent dc1ced7dcc
commit 462ebf7c25
4 changed files with 38 additions and 13 deletions

View File

@@ -17,7 +17,7 @@ int main() {
tc::group::E(7),
tc::group::B(6),
tc::group::B(7),
tc::group::B(8),
tc::group::B(8)
};
for (const auto &group : groups) {

View File

@@ -9,7 +9,7 @@ int main() {
for (size_t target = 1; target < vars.size(); target++) {
auto &action = vars.path[target];
std::cout << action.coset << " * " << action.gen << " = " << target << std::endl;
std::cout << action.from_idx << " * " << action.gen << " = " << target << std::endl;
}
return 0;

View File

@@ -6,15 +6,14 @@
namespace tc {
struct Action {
int coset = -1;
int from_idx = -1;
int gen = -1;
int target = -1;
Action() = default;
Action(const Action &) = default;
Action(int coset, int gen, int target);
Action(int from_idx, int gen);
};
struct Cosets {
@@ -52,6 +51,8 @@ namespace tc {
[[nodiscard]] Rel shift(int off) const;
};
struct SubGroup;
struct Group {
const int ngens;
std::vector<std::vector<int>> _mults;
@@ -67,11 +68,20 @@ namespace tc {
[[nodiscard]] std::vector<Rel> rels() const;
[[nodiscard]] SubGroup subgroup(const std::vector<int> &gens) const;
[[nodiscard]] Group product(const Group &other) const;
[[nodiscard]] Group power(int p) const;
[[nodiscard]] Cosets solve(const std::vector<int>& sub_gens = {}) const;
[[nodiscard]] Cosets solve(const std::vector<int> &sub_gens = {}) const;
};
struct SubGroup : public Group {
const std::vector<int> gen_map;
const Group &parent;
SubGroup(const Group &parent, const std::vector<int> &gen_map);
};
Group operator*(const Group &g, const Group &h);

View File

@@ -4,8 +4,8 @@
#include <sstream>
namespace tc {
Action::Action(int coset, int gen, int target)
: coset(coset), gen(gen), target(target) {
Action::Action(int from_idx, int gen)
: from_idx(from_idx), gen(gen) {
}
Cosets::Cosets(int ngens)
@@ -21,8 +21,8 @@ namespace tc {
data[coset * ngens + gen] = target;
data[target * ngens + gen] = coset;
if (path[target].coset == -1) {
path[target] = Action(coset, gen, target);
if (path[target].from_idx == -1) {
path[target] = Action(coset, gen);
}
}
@@ -32,8 +32,8 @@ namespace tc {
data[idx] = target;
data[target * ngens + gen] = coset;
if (path[target].coset == -1) {
path[target] = Action(coset, gen, target);
if (path[target].from_idx == -1) {
path[target] = Action(coset, gen);
}
}
@@ -89,6 +89,10 @@ namespace tc {
return res;
}
SubGroup Group::subgroup(const std::vector<int> &gens) const {
return SubGroup(*this, gens);
}
Group Group::product(const Group &other) const {
std::stringstream ss;
ss << name << "*" << other.name;
@@ -115,4 +119,15 @@ namespace tc {
return g;
}
}
SubGroup::SubGroup(const Group &parent, const std::vector<int> &gen_map)
: Group(gen_map.size()), parent(parent), gen_map(gen_map) {
for (size_t i = 0; i < gen_map.size(); ++i) {
for (size_t j = 0; j < gen_map.size(); ++j) {
int mult = parent.get(gen_map[i], gen_map[j]);
set(Rel(i, j, mult));
}
}
}
}