Skip to content

Commit f8b44fb

Browse files
hpcombi: add support for SchreierSims
1 parent f82b684 commit f8b44fb

2 files changed

Lines changed: 24 additions & 7 deletions

File tree

src/libsemigroups_pybind11/schreier_sims.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from typing_extensions import Self as _Self
1414

1515
from _libsemigroups_pybind11 import (
16+
LIBSEMIGROUPS_HPCOMBI_ENABLED as _LIBSEMIGROUPS_HPCOMBI_ENABLED,
1617
Perm1 as _Perm1,
1718
Perm2 as _Perm2,
1819
# Perm4 as _Perm4,
@@ -30,6 +31,12 @@
3031
)
3132
from .detail.decorators import copydoc as _copydoc
3233

34+
if _LIBSEMIGROUPS_HPCOMBI_ENABLED:
35+
from _libsemigroups_pybind11 import (
36+
SchreierSimsHPCombiPerm16 as _SchreierSimsHPCombiPerm16,
37+
hpcombi_Perm16 as _HPCombiPerm16,
38+
)
39+
3340
Element = _TypeVar("Element")
3441

3542
########################################################################
@@ -40,11 +47,16 @@
4047
class SchreierSims(_CxxWrapper):
4148
__doc__ = _SchreierSimsPerm1.__doc__
4249

43-
_py_template_params_to_cxx_type = {
44-
(_Perm1,): _SchreierSimsPerm1,
45-
(_Perm2,): _SchreierSimsPerm2,
46-
# (_Perm4,): _SchreierSims,
47-
}
50+
_py_template_params_to_cxx_type = (
51+
{
52+
(_Perm1,): _SchreierSimsPerm1,
53+
(_Perm2,): _SchreierSimsPerm2,
54+
# (_Perm4,): _SchreierSims,
55+
}
56+
| {(_HPCombiPerm16,): _SchreierSimsHPCombiPerm16}
57+
if _LIBSEMIGROUPS_HPCOMBI_ENABLED
58+
else {}
59+
)
4860

4961
_cxx_type_to_py_template_params = dict(
5062
zip(

src/schreier-sims.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@
2323
#include <memory> // for allocator, make_unique, unique_ptr
2424

2525
// libsemigroups headers
26-
#include <libsemigroups/libsemigroups.hpp>
26+
#include <libsemigroups/hpcombi.hpp>
2727
#include <libsemigroups/schreier-sims.hpp>
28+
#include <libsemigroups/transf.hpp>
2829

2930
// pybind11....
3031
#include <pybind11/pybind11.h>
@@ -112,6 +113,7 @@ Add a base point to the stabiliser chain.
112113
:raises LibsemigroupsError: if :any:`finished()` returns ``True``.
113114
114115
:complexity: Linear in the current number of base points.)pbdoc");
116+
115117
thing.def("add_generator",
116118
&SchreierSims_::add_generator,
117119
py::arg("x"),
@@ -514,12 +516,15 @@ corresponding to the intersection of *x* and *y*.
514516
:raises LibsemigroupsError: if *result* is not empty.
515517
)pbdoc");
516518
} // bind_schreier_sims
517-
} // namespace
519+
} // namespace
518520

519521
void init_schreier_sims(py::module& m) {
520522
// One call to bind is required per list of types
521523
bind_schreier_sims<255, uint8_t, Perm<0, uint8_t>>(m, "Perm1");
522524
bind_schreier_sims<511, uint16_t, Perm<0, uint16_t>>(m, "Perm2");
525+
#ifdef LIBSEMIGROUPS_HPCOMBI_ENABLED
526+
bind_schreier_sims<16, uint8_t, HPCombi::Perm16>(m, "HPCombiPerm16");
527+
#endif
523528
}
524529

525530
} // namespace libsemigroups

0 commit comments

Comments
 (0)