|
20 | 20 | #include <functional> // for function |
21 | 21 | #include <string> // for string, basic_string, oper... |
22 | 22 |
|
| 23 | +#include <libsemigroups/cong.hpp> // for Congruence |
| 24 | +#include <libsemigroups/detail/multi-view.hpp> // for MultiView |
23 | 25 | #include <libsemigroups/froidure-pin-base.hpp> // for FroidurePinBase |
24 | 26 | #include <libsemigroups/kambites.hpp> // for Kambites |
25 | 27 | #include <libsemigroups/knuth-bendix-class.hpp> // for KnuthBendix |
26 | 28 | #include <libsemigroups/presentation.hpp> // for Presentation |
| 29 | +#include <libsemigroups/stephen.hpp> // for Stephen |
27 | 30 | #include <libsemigroups/to-presentation.hpp> // for to<Presentation> |
| 31 | +#include <libsemigroups/todd-coxeter.hpp> // for ToddCoxeter |
28 | 32 | #include <libsemigroups/types.hpp> // for word_type |
29 | 33 |
|
30 | 34 | #include <pybind11/functional.h> |
@@ -109,6 +113,28 @@ namespace libsemigroups { |
109 | 113 | m.def(fn_name.c_str(), |
110 | 114 | [](Kambites<WordIn>& k) { return to<Presentation<WordOut>>(k); }); |
111 | 115 | } |
| 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 | + } |
112 | 138 | } // namespace |
113 | 139 |
|
114 | 140 | void init_to_present(py::module& m) { |
@@ -165,6 +191,25 @@ namespace libsemigroups { |
165 | 191 | bind_kambites_to_pres<detail::MultiView<std::string>, std::string>( |
166 | 192 | m, "string"); |
167 | 193 |
|
| 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 | + |
168 | 213 | //////////////////////////////////////////////////////////////////////////// |
169 | 214 | // to<InversePresentation> |
170 | 215 | //////////////////////////////////////////////////////////////////////////// |
|
0 commit comments