first attempt at a general triangulation algorithm

This commit is contained in:
2020-01-07 14:37:41 -05:00
parent 4d4ef45956
commit d34d3e6af5
4 changed files with 180 additions and 27 deletions

View File

@@ -28,6 +28,10 @@ namespace tc {
[[nodiscard]] Group product(const Group &other) const;
[[nodiscard]] Group power(int p) const;
[[nodiscard]] Group shrink(const std::vector<int> &gens) const;
[[nodiscard]] bool trivial() const;
};
Group operator*(const Group &g, const Group &h);

View File

@@ -66,6 +66,35 @@ namespace tc {
return g;
}
Group Group::shrink(const std::vector<int> &gens) const {
Group g(ngens);
for (const auto &i : gens) {
for (const auto &j : gens) {
g._mults[i][j] = _mults[i][j];
}
}
std::stringstream ss;
ss << name << "{";
for (auto e : gens) ss << " " << e;
ss << " }";
g.name = ss.str();
return g;
}
bool Group::trivial() const {
for (int i = 0; i < ngens; ++i) {
for (int j = 0; j < ngens; ++j) {
if (_mults[i][j] != 2) {
return false;
}
}
}
return true;
}
Group operator*(const Group &g, const Group &h) {
return g.product(h);
}