Skip to content

Commit 1347a19

Browse files
committed
to: add Cong, Stephen, ToddCoxeter -> Presentation
1 parent 7717a5e commit 1347a19

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

src/to-presentation.cpp

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,15 @@
2020
#include <functional> // for function
2121
#include <string> // for string, basic_string, oper...
2222

23+
#include <libsemigroups/cong.hpp> // for Congruence
24+
#include <libsemigroups/detail/multi-view.hpp> // for MultiView
2325
#include <libsemigroups/froidure-pin-base.hpp> // for FroidurePinBase
2426
#include <libsemigroups/kambites.hpp> // for Kambites
2527
#include <libsemigroups/knuth-bendix-class.hpp> // for KnuthBendix
2628
#include <libsemigroups/presentation.hpp> // for Presentation
29+
#include <libsemigroups/stephen.hpp> // for Stephen
2730
#include <libsemigroups/to-presentation.hpp> // for to<Presentation>
31+
#include <libsemigroups/todd-coxeter.hpp> // for ToddCoxeter
2832
#include <libsemigroups/types.hpp> // for word_type
2933

3034
#include <pybind11/functional.h>
@@ -109,6 +113,28 @@ namespace libsemigroups {
109113
m.def(fn_name.c_str(),
110114
[](Kambites<WordIn>& k) { return to<Presentation<WordOut>>(k); });
111115
}
116+
117+
template <typename WordIn, typename WordOut>
118+
void bind_congruence_to_pres(py::module& m, std::string const& name) {
119+
std::string fn_name = std::string("to_presentation_") + name;
120+
m.def(fn_name.c_str(),
121+
[](Congruence<WordIn>& c) { return to<Presentation<WordOut>>(c); });
122+
}
123+
124+
template <typename PresIn, typename WordOut>
125+
void bind_stephen_to_pres(py::module& m, std::string const& name) {
126+
std::string fn_name = std::string("to_presentation_") + name;
127+
m.def(fn_name.c_str(),
128+
[](Stephen<PresIn>& s) { return to<Presentation<WordOut>>(s); });
129+
}
130+
131+
template <typename WordIn, typename WordOut>
132+
void bind_todd_coxeter_to_pres(py::module& m, std::string const& name) {
133+
std::string fn_name = std::string("to_presentation_") + name;
134+
m.def(fn_name.c_str(), [](ToddCoxeter<WordIn>& tc) {
135+
return to<Presentation<WordOut>>(tc);
136+
});
137+
}
112138
} // namespace
113139

114140
void init_to_present(py::module& m) {
@@ -165,6 +191,25 @@ namespace libsemigroups {
165191
bind_kambites_to_pres<detail::MultiView<std::string>, std::string>(
166192
m, "string");
167193

194+
// From Congruence
195+
bind_congruence_to_pres<word_type, word_type>(m, "word");
196+
bind_congruence_to_pres<word_type, std::string>(m, "string");
197+
bind_congruence_to_pres<std::string, word_type>(m, "word");
198+
bind_congruence_to_pres<std::string, std::string>(m, "string");
199+
200+
// From Stephen
201+
bind_stephen_to_pres<Presentation<word_type>, word_type>(m, "word");
202+
bind_stephen_to_pres<Presentation<word_type>, std::string>(m, "string");
203+
bind_stephen_to_pres<InversePresentation<word_type>, word_type>(m, "word");
204+
bind_stephen_to_pres<InversePresentation<word_type>, std::string>(m,
205+
"string");
206+
207+
// From ToddCoxeter
208+
bind_todd_coxeter_to_pres<word_type, word_type>(m, "word");
209+
bind_todd_coxeter_to_pres<word_type, std::string>(m, "string");
210+
bind_todd_coxeter_to_pres<std::string, word_type>(m, "word");
211+
bind_todd_coxeter_to_pres<std::string, std::string>(m, "string");
212+
168213
////////////////////////////////////////////////////////////////////////////
169214
// to<InversePresentation>
170215
////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)