|
25 | 25 | #include <initializer_list> // for initializer_list
|
26 | 26 | #include <iosfwd> // for string
|
27 | 27 | #include <memory> // for allocator, make_unique, unique_ptr
|
| 28 | +#include <regex> // for regex_replace |
28 | 29 | #include <string> // for char_traits, operator==, operator+
|
29 | 30 | #include <unordered_map> // for operator==, unordered_map
|
30 | 31 | #include <utility> // for make_pair, pair
|
@@ -58,6 +59,10 @@ namespace libsemigroups {
|
58 | 59 | std::string result = detail::to_string(x);
|
59 | 60 | std::replace(result.begin(), result.end(), '{', '[');
|
60 | 61 | std::replace(result.begin(), result.end(), '}', ']');
|
| 62 | + result = std::regex_replace( |
| 63 | + result, std::regex(R"(-2147483648\b)"), "NEGATIVE_INFINITY"); |
| 64 | + result = std::regex_replace( |
| 65 | + result, std::regex(R"(\b2147483646\b)"), "POSITIVE_INFINITY"); |
61 | 66 | return result;
|
62 | 67 | }
|
63 | 68 |
|
@@ -165,6 +170,7 @@ namespace libsemigroups {
|
165 | 170 | str.c_str(),
|
166 | 171 | matrix_repr(x).c_str());
|
167 | 172 | })
|
| 173 | + .def("__pow__", &matrix_helpers::pow<T>) |
168 | 174 | .def_static("make_identity",
|
169 | 175 | py::overload_cast<size_t>(&T::identity))
|
170 | 176 | .def(py::init<size_t, size_t>());
|
|
0 commit comments