From 41907d927dd5ba546cb35809bf9e05890064573c Mon Sep 17 00:00:00 2001 From: David Allemang Date: Mon, 18 Nov 2019 11:15:20 -0500 Subject: [PATCH] comment pseudocode for add_row --- main.cpp | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/main.cpp b/main.cpp index c11843c..bf67aa6 100644 --- a/main.cpp +++ b/main.cpp @@ -19,7 +19,7 @@ void pp(const Table &t) { } } -void new_coset(const int ngens, const std::vector &rels, +void add_row(const int ngens, const std::vector &rels, Table &cosets, std::vector &reltables, Table &starts, Table &ends) { @@ -27,7 +27,7 @@ void new_coset(const int ngens, const std::vector &rels, cosets.emplace_back(ngens, -1); - for (size_t i = 0; i < rels.size(); ++i) { + for (unsigned int i = 0; i < rels.size(); ++i) { auto &table = reltables[i]; unsigned int R = rels[i].size(); @@ -41,7 +41,27 @@ void new_coset(const int ngens, const std::vector &rels, } } -Table solve_tc(int ngens, const Gens &sub, const std::vector &rels) { +/** + * @return true if anything was learned + */ +void learn(Table &coset, const std::vector &rels, + std::vector
&reltables, Table &starts, Table &ends) { + +// set learning +// while learning +// not learning +// for each table +// for each row of the table +// load left and right from starts/ends +// if the left and right already meet, skip +// try to deduce more about the row from the left (don't pass right) +// try to deduce more about the row from the right (don't pass left) +// if the left and right meet +// set learning +// write to the coset table +} + +Table solve_tc(int ngens, const Gens &subgens, const std::vector &rels) { Table cosets; std::vector
reltables(rels.size()); @@ -49,7 +69,11 @@ Table solve_tc(int ngens, const Gens &sub, const std::vector &rels) { Table starts(rels.size()); // [rel_table][coset] Table ends(rels.size()); - new_coset(ngens, rels, cosets, reltables, starts, ends); + // set up initial coset + add_row(ngens, rels, cosets, reltables, starts, ends); + for (const auto &gen : subgens) { + cosets[0][gen] = 0; + } return cosets; }