Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ format:
# See https://github.com/astral-sh/ruff/issues/8232 for updates.
ruff check --select I --fix-only
ruff format
find src -name "*.*pp" -type f -exec clang-format-15 -i --verbose {} +

check: doctest
pytest -vv tests/test_*.py
Expand Down
39 changes: 38 additions & 1 deletion docs/source/main-algorithms/todd-coxeter/class/modifiers.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
..
Copyright (c) 2024 J. D. Mitchell
Copyright (c) 2024-2026 J. D. Mitchell

Distributed under the terms of the GPL license version 3.

Expand All @@ -15,8 +15,45 @@ that can be used to modify the state of a :any:`ToddCoxeter` instance. In other
words, for modifying the :any:`WordGraph` that is the output of the algorithm in
a way that preserves it up to isomorphism.

Contents
--------

.. autosummary::
:signatures: short

ToddCoxeter.perform_lookahead
ToddCoxeter.perform_lookahead_for
ToddCoxeter.perform_lookahead_until
ToddCoxeter.perform_lookbehind
ToddCoxeter.perform_lookbehind_no_checks
ToddCoxeter.perform_lookbehind_for
ToddCoxeter.perform_lookbehind_for_no_checks
ToddCoxeter.perform_lookbehind_until
ToddCoxeter.perform_lookbehind_until_no_checks
ToddCoxeter.shrink_to_fit
ToddCoxeter.standardize

Full API
--------

.. automethod:: ToddCoxeter.perform_lookahead

.. automethod:: ToddCoxeter.perform_lookahead_for

.. automethod:: ToddCoxeter.perform_lookahead_until

.. automethod:: ToddCoxeter.perform_lookbehind

.. automethod:: ToddCoxeter.perform_lookbehind_no_checks

.. automethod:: ToddCoxeter.perform_lookbehind_for

.. automethod:: ToddCoxeter.perform_lookbehind_for_no_checks

.. automethod:: ToddCoxeter.perform_lookbehind_until

.. automethod:: ToddCoxeter.perform_lookbehind_until_no_checks

.. automethod:: ToddCoxeter.shrink_to_fit

.. automethod:: ToddCoxeter.standardize
18 changes: 18 additions & 0 deletions etc/catch-cpp-to-pytest-f1.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
function! CatchCPPToPytest()
silent '<,'>s/{/[/ge
silent '<,'>s/}/]/ge
silent '<,'>s/::/./ge
silent '<,'>s/true/True/ge
silent '<,'>s/false/False/ge
silent '<,'>s/;//ge
silent '<,'>s/REQUIRE(\([^)]*\))/assert \1/ge
silent '<,'>s/<[^>]*>//ge
silent '<,'>s/REQUIRE_THROWS_AS(\([^,]\+\),\s\+LibsemigroupsException)/with pytest.raises(RuntimeError):\r assert \1/ge
silent '<,'>s/\(\d\)\(\d\+_w\)/\1, \2/ge
silent '<,'>s/\<\(\d\)_w/\1]/ge
silent '<,'>s/!/not /ge
silent '<,'>s/\/\/.*$//ge
endfunction

map! <F1> <ESC>:call CatchCPPToPytest()<CR>i
map <F1> :call CatchCPPToPytest()<CR>
29 changes: 8 additions & 21 deletions etc/catch-cpp-to-pytest.vim → etc/doxy-to-sphinx-f2.vim
Original file line number Diff line number Diff line change
@@ -1,29 +1,12 @@
function! CatchCPPToPytest()
silent '<,'>s/{/[/ge
silent '<,'>s/}/]/ge
silent '<,'>s/::/./ge
silent '<,'>s/true/True/ge
silent '<,'>s/false/False/ge
silent '<,'>s/;//ge
silent '<,'>s/REQUIRE(\([^)]*\))/assert \1/ge
silent '<,'>s/<[^>]*>//ge
silent '<,'>s/REQUIRE_THROWS_AS(\([^,]\+\),\s\+LibsemigroupsException)/with pytest.raises(RuntimeError):\r assert \1/ge
silent '<,'>s/\(\d\)\(\d\+_w\)/\1, \2/ge
silent '<,'>s/\<\(\d\)_w/\1]/ge
silent '<,'>s/!/not /ge
silent '<,'>s/\/\/.*$//ge
endfunction

function! DoxyToSphinx()
silent '<,'>s/\/\/!//ge
silent '<,'>s/^.*\\tparam.*$//ge
silent '<,'>s/\\param\s\+\(\w\)\+\(.*\)$/:param \1: \2\r :type \1: ??/ge
silent '<,'>s/\\param\s\+\(\w\+\)/:param \1:/ge
silent '<,'>s/\\returns/:returns:/ge
silent '<,'>s/\\throws LibsemigroupsException/:raises RuntimeError:/ge
silent '<,'>s/`\{-1}/``/ge
silent '<,'>s/`\{4}/``/ge
silent '<,'>s/\\p\s\+\(\w\+\)/``\1``/ge
silent '<,'>s/\\ref\s\+\(\w\+\)/:py:any:`\1`/ge
silent '<,'>s/\\p\s\+\(\w\+\)/*\1*/ge
silent '<,'>s/\\c\s\+\(\w\+\)/``\1``/ge
silent '<,'>s/``true``/``True``/ge
silent '<,'>s/``false``/``False``/ge
Expand All @@ -33,9 +16,13 @@ function! DoxyToSphinx()
silent '<,'>s/\\f\$\(.\{-}\)\\f\$/:math:`\1`/ge
silent '<,'>s/:math:``\(.\{-}\)``/:math:`\1`/ge
silent '<,'>s/``\(.\{-}\)``_/`\1`_/ge
silent '<,'>s/\\ref_knuth_bendix/:any:`KnuthBendix`/ge
silent '<,'>s/\\brief//ge
silent '<,'>s/\\ref\s\+\([a-zA-z:]\+\)/:any:`\1`/ge
silent '<,'>s/:any:``\(.\{-}\)``/:any:`\1`/ge
silent '<,'>s/::/./ge
silent '<,'>s/^\s*//ge
endfunction

map! <F1> <ESC>:call CatchCPPToPytest()<CR>i
map <F1> :call CatchCPPToPytest()<CR>
map! <F2> <ESC>:call DoxyToSphinx()<CR>i
map <F2> :call DoxyToSphinx()<CR>
5 changes: 3 additions & 2 deletions src/bmat8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,14 @@ lists in *rows*.
:raises LibsemigroupsError: if the rows of *rows* are not all of the same length.

:complexity: Constant.)pbdoc");

thing.def(
"degree", [](BMat8 const& self) { return 8; }, R"pbdoc(
Returns the degree of *self*.

This function always returns ``8``.

:returns: The degree of the matrisx, ``8``.
:returns: The degree of the matrix, ``8``.
:rtype: int
)pbdoc");

Expand All @@ -223,7 +224,7 @@ Returns the integer representation of a :any:`BMat8`.

Returns a non-negative integer obtained by interpreting an 8 x 8 :any:`BMat8`
as a sequence of 64 bits (reading rows left to right, from top to bottom) and
then realising this sequence as an unsigned int.
then realising this sequence as an integer.

:returns:
The integer value of the matrix.
Expand Down
2 changes: 1 addition & 1 deletion src/cong.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ obviously infinite; ``False`` is returned if it is not.
congruence has infinitely many classes.
)pbdoc");
} // bind_cong
} // namespace
} // namespace

void init_cong(py::module& m) {
bind_cong<word_type>(m, "CongruenceWord");
Expand Down
2 changes: 1 addition & 1 deletion src/froidure-pin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1269,7 +1269,7 @@ This function returns the element of *fp* obtained by evaluating *w*.
});
}
} // bind_froidure_pin_stateful
} // namespace
} // namespace

void init_froidure_pin(py::module& m) {
bind_froidure_pin_stateless<Transf<0, uint8_t>>(m, "Transf1");
Expand Down
2 changes: 1 addition & 1 deletion src/hpcombi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2406,7 +2406,7 @@ This function returns a newly constructed :any:`PPerm16` with the same image as
True
)pbdoc");
} // init_hpcombi_pperm16
} // namespace
} // namespace
} // namespace HPCombi

namespace libsemigroups {
Expand Down
2 changes: 1 addition & 1 deletion src/konieczny.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ not already known.
int
)pbdoc");
} // bind_konieczny
} // namespace
} // namespace

void init_konieczny(py::module& m) {
bind_konieczny<BMat8>(m, "BMat8");
Expand Down
4 changes: 2 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ namespace libsemigroups {
#ifdef VERSION_INFO
m.attr("__version__") = VERSION_INFO;
#else
m.attr("__version__") = "dev";
m.attr("__version__") = "dev";
#endif
#ifdef LIBSEMIGROUPS_EIGEN_ENABLED
m.attr("LIBSEMIGROUPS_EIGEN_ENABLED")
= static_cast<bool>(LIBSEMIGROUPS_EIGEN_ENABLED);
#else
m.attr("LIBSEMIGROUPS_EIGEN_ENABLED") = false;
m.attr("LIBSEMIGROUPS_EIGEN_ENABLED") = false;
#endif

#ifdef LIBSEMIGROUPS_HPCOMBI_ENABLED
Expand Down
2 changes: 1 addition & 1 deletion src/present.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1655,7 +1655,7 @@ defined in the alphabet, and that the inverses act as semigroup inverses.
* :any:`presentation.throw_if_bad_inverses`
)pbdoc");
} // bind_inverse_present
} // namespace
} // namespace

void init_present(py::module& m) {
bind_present<word_type>(m, "PresentationWord");
Expand Down
2 changes: 1 addition & 1 deletion src/schreier-sims.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ corresponding to the intersection of *x* and *y*.
:raises LibsemigroupsError: if *result* is not empty.
)pbdoc");
} // bind_schreier_sims
} // namespace
} // namespace

void init_schreier_sims(py::module& m) {
// One call to bind is required per list of types
Expand Down
11 changes: 7 additions & 4 deletions src/todd-coxeter-impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1400,10 +1400,13 @@ returned by this function may not be compatible with the relations of
// Modifiers
////////////////////////////////////////////////////////////////////////

thing.def("perform_lookahead",
&ToddCoxeterImpl_::perform_lookahead,
py::arg("stop_early"),
R"pbdoc(
thing.def(
"perform_lookahead",
[](ToddCoxeterImpl_& self, bool stop_early) {
self.perform_lookahead(stop_early);
},
py::arg("stop_early"),
R"pbdoc(
:sig=(self: ToddCoxeter, stop_early: bool) -> None:

Perform a lookahead.
Expand Down
Loading