add bound to support for infinite groups and free relations

special values tc::UNBOUND and tc::FREE used for this.
This commit is contained in:
David Allemang
2022-09-16 11:49:09 -04:00
parent a867631393
commit c7c6784643
5 changed files with 70 additions and 22 deletions

View File

@@ -40,7 +40,7 @@ namespace tc {
}
};
Cosets solve(const Group &group, const std::vector<Gen> &sub_gens) {
Cosets solve(const Group &group, const std::vector<Gen> &sub_gens, const Coset &bound) {
auto ngens = group.ngens;
// region Initialize Cosets Table
@@ -48,6 +48,7 @@ namespace tc {
cosets.add_row();
if (ngens == 0) {
cosets.complete = true;
return cosets;
}
@@ -57,9 +58,22 @@ namespace tc {
}
// endregion
auto rels = group.rels();
// region Initialize Relation Tables
std::vector<std::tuple<Gen, Gen, Mult>> rels;
for (const auto &[i, j, m]: group._mults) {
// The algorithm only works for Coxeter groups; multiplicities m_ii=1 are assumed. Relation tables
// _may_ be added for them, but they are redundant and hurt performance so are skipped.
if (i == j) continue;
// Coxeter groups admit infinite multiplicities, represented by contexpr tc::FREE. Relation tables
// for these should be skipped.
if (m == FREE) {
continue;
}
rels.emplace_back(i, j, m);
}
Tables rel_tables(rels);
std::vector<std::vector<size_t>> tables_for(ngens);
int rel_idx = 0;
@@ -97,6 +111,10 @@ namespace tc {
while (idx < cosets.data.size() and cosets.isset(idx))
idx++;
if (cosets.size() >= bound) {
return cosets;
}
// if there are none, then return
if (idx == cosets.data.size()) {
// todo unrolled linked list interval
@@ -191,6 +209,7 @@ namespace tc {
}
}
cosets.complete = true;
return cosets;
}
}