Skip to content

Commit 5c49000

Browse files
reiniscirponsjames-d-mitchellJoseph-Edwards
authored
Add support for Sims for v1 release, version 2.0, now with better branch name! (#220)
* Start adding python bindings for Sims * Fix some issues with Sims1 * Make Sims1, Sims2 more easily importable, add tests * Add more sims constructs * Add pruners to sims * Try adding more stuff * Fix bug in chainable setters, add test markers, port over more tests. * Add functions from sims namespace * Start adding docs for Sims * Start fixin doc * First pass formatting changes to docs * More d o c u m e n t a t i o n improvements * Add more tests * Fixes after recent changes in libsemigroups * Reorg doc * Doc tweaks * Review return value policy * Linting + formatting * Fix spelling * Uncomment sims tests * Add missing asserts --------- Co-authored-by: James D. Mitchell <jdm3@st-andrews.ac.uk> Co-authored-by: Joseph Edwards <josephdavidedwards@gmail.com>
1 parent d539c62 commit 5c49000

24 files changed

+2944
-26
lines changed

docs/source/conf.py

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ def doc_only_run(self):
5656
docstring = list(node.findall(condition=desc_content))
5757

5858
if not docstring:
59-
logger.warning(f"The docstring for {self.arguments[0]} cannot be found.")
59+
logger.warning(
60+
f"The docstring for {self.arguments[0]} cannot be found."
61+
)
6062
return []
6163

6264
return docstring
@@ -102,7 +104,9 @@ def no_doc_run(self):
102104
source_suffix = ".rst"
103105
master_doc = "index"
104106
project = "libsemigroups_pybind11"
105-
copyright = "2021-2024, Joseph Edwards, James Mitchell, Maria Tsalakou, Murray Whyte"
107+
copyright = (
108+
"2021-2024, Joseph Edwards, James Mitchell, Maria Tsalakou, Murray Whyte"
109+
)
106110
author = "Joseph Edwards, James Mitchell, Maria Tsalakou, Murray Whyte"
107111
version = "1.0.0"
108112
release = "1.0.0"
@@ -160,7 +164,17 @@ def no_doc_run(self):
160164
r"libsemigroups::DynamicMatrix<libsemigroups::IntegerPlus<long long>, "
161165
r"libsemigroups::IntegerProd<long long>, libsemigroups::IntegerZero"
162166
r"<long long>, libsemigroups::IntegerOne<long long>, long long>"
163-
): "Matrix",
167+
): r"Matrix",
168+
r"libsemigroups::SimsStats": r"SimsStats",
169+
r"libsemigroups::Sims1": r"Sims1",
170+
r"libsemigroups::Sims2": r"Sims2",
171+
r"libsemigroups::RepOrc": r"RepOrc",
172+
r"libsemigroups::MinimalRepOrc": r"MinimalRepOrc",
173+
(
174+
r"libsemigroups::DynamicMatrix<libsemigroups::BooleanPlus, "
175+
r"libsemigroups::BooleanProd, libsemigroups::BooleanZero, "
176+
r"libsemigroups::BooleanOne, int>"
177+
): r"Matrix",
164178
}
165179

166180
# This dictionary should be of the form class_name -> (pattern, repl), where
@@ -183,6 +197,17 @@ def no_doc_run(self):
183197
],
184198
"FroidurePinPBR": [(r"\bPBR\b", "Element")],
185199
"SchreierSimsPerm1": [(r"\bPerm1\b", "Element")],
200+
"Sims1": [("SubclassType", "Sims1"), ("SimsSettingsSims1", "Sims1")],
201+
"Sims2": [("SubclassType", "Sims2"), ("SimsSettingsSims2", "Sims2")],
202+
"MinimalRepOrc": [
203+
("SubclassType", "MinimalRepOrc"),
204+
("SimsSettingsMinimalRepOrc", "MinimalRepOrc"),
205+
(r"\bRepOrc\b", "MinimalRepOrc"),
206+
],
207+
"RepOrc": [
208+
("SubclassType", "RepOrc"),
209+
("SimsSettingsRepOrc", "RepOrc"),
210+
],
186211
}
187212

188213
# This is what sphinx considers to be a signature

docs/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ See the installation instructions:
7272
main-algorithms/kambites/index
7373
main-algorithms/knuth-bendix/index
7474
main-algorithms/konieczny/index
75+
main-algorithms/low-index/index
7576
main-algorithms/radoszewski-rytter/index
7677
main-algorithms/schreier-sims/index
77-
main-algorithms/sims/index
7878
main-algorithms/stephen/index
7979
main-algorithms/todd-coxeter/index
8080

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
.. Copyright (c) 2024 R. Cirpons
2+
3+
Distributed under the terms of the GPL license version 3.
4+
5+
The full license is in the file LICENSE, distributed with this software.
6+
7+
.. currentmodule:: _libsemigroups_pybind11
8+
9+
Classes for low-index congruences
10+
=================================
11+
12+
On this page we describe the functionality relating to the Sims's
13+
low-index congruence algorithm for semigroups and monoids that is available in
14+
``libsemigroups_pybind11``.
15+
16+
.. doctest::
17+
18+
>>> from libsemigroups_pybind11 import Sims1, Presentation, presentation
19+
>>> p = Presentation([0, 1])
20+
>>> presentation.add_rule(p, [0, 1], [1, 0])
21+
>>> sims = Sims1(p)
22+
>>> sims.number_of_congruences(4)
23+
117
24+
25+
.. toctree::
26+
:maxdepth: 1
27+
28+
minimalreporc
29+
reporc
30+
sims1
31+
sims2
32+
simsrefinerfaithful
33+
simsrefinerideals
34+
simsstats
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
.. Copyright (c) 2025 J. D. Mitchell
2+
3+
Distributed under the terms of the GPL license version 3.
4+
5+
The full license is in the file LICENSE, distributed with this software.
6+
7+
.. currentmodule:: _libsemigroups_pybind11
8+
9+
The MinimalRepOrc class
10+
=======================
11+
12+
.. autoclass:: MinimalRepOrc
13+
:doc-only:
14+
:class-doc-from: class
15+
16+
Contents
17+
--------
18+
19+
.. autosummary::
20+
:nosignatures:
21+
22+
~MinimalRepOrc
23+
MinimalRepOrc.__init__
24+
MinimalRepOrc.add_excluded_pair
25+
MinimalRepOrc.add_included_pair
26+
MinimalRepOrc.add_pruner
27+
MinimalRepOrc.clear_excluded_pairs
28+
MinimalRepOrc.clear_included_pairs
29+
MinimalRepOrc.clear_long_rules
30+
MinimalRepOrc.clear_pruners
31+
MinimalRepOrc.excluded_pairs
32+
MinimalRepOrc.first_long_rule_position
33+
MinimalRepOrc.idle_thread_restarts
34+
MinimalRepOrc.included_pairs
35+
MinimalRepOrc.init
36+
MinimalRepOrc.long_rule_length
37+
MinimalRepOrc.long_rules
38+
MinimalRepOrc.number_of_long_rules
39+
MinimalRepOrc.number_of_threads
40+
MinimalRepOrc.presentation
41+
MinimalRepOrc.pruners
42+
MinimalRepOrc.stats
43+
44+
Full API
45+
--------
46+
47+
.. autoclass:: MinimalRepOrc
48+
:no-doc:
49+
:class-doc-from: class
50+
:members:
51+
:inherited-members:
52+
:special-members: __init__
53+
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
.. Copyright (c) 2025 J. D. Mitchell
2+
3+
Distributed under the terms of the GPL license version 3.
4+
5+
The full license is in the file LICENSE, distributed with this software.
6+
7+
.. currentmodule:: _libsemigroups_pybind11
8+
9+
The RepOrc class
10+
=======================
11+
12+
.. autoclass:: RepOrc
13+
:doc-only:
14+
:class-doc-from: class
15+
16+
Contents
17+
--------
18+
19+
.. autosummary::
20+
:nosignatures:
21+
22+
~RepOrc
23+
RepOrc.__init__
24+
RepOrc.add_excluded_pair
25+
RepOrc.add_included_pair
26+
RepOrc.add_pruner
27+
RepOrc.clear_excluded_pairs
28+
RepOrc.clear_included_pairs
29+
RepOrc.clear_long_rules
30+
RepOrc.clear_pruners
31+
RepOrc.excluded_pairs
32+
RepOrc.first_long_rule_position
33+
RepOrc.idle_thread_restarts
34+
RepOrc.included_pairs
35+
RepOrc.init
36+
RepOrc.long_rule_length
37+
RepOrc.long_rules
38+
RepOrc.number_of_long_rules
39+
RepOrc.number_of_threads
40+
RepOrc.presentation
41+
RepOrc.pruners
42+
RepOrc.stats
43+
44+
Full API
45+
--------
46+
47+
.. autoclass:: RepOrc
48+
:no-doc:
49+
:class-doc-from: class
50+
:members:
51+
:inherited-members:
52+
:special-members: __init__
53+
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
.. Copyright (c) 2025 J. D. Mitchell
2+
3+
Distributed under the terms of the GPL license version 3.
4+
5+
The full license is in the file LICENSE, distributed with this software.
6+
7+
.. currentmodule:: _libsemigroups_pybind11
8+
9+
The Sims1 class
10+
===============
11+
12+
.. autoclass:: Sims1
13+
:doc-only:
14+
:class-doc-from: class
15+
16+
17+
Contents
18+
--------
19+
20+
.. autosummary::
21+
:nosignatures:
22+
23+
~Sims1
24+
Sims1.add_excluded_pair
25+
Sims1.add_included_pair
26+
Sims1.add_pruner
27+
Sims1.clear_excluded_pairs
28+
Sims1.clear_included_pairs
29+
Sims1.clear_long_rules
30+
Sims1.clear_pruners
31+
Sims1.copy
32+
Sims1.excluded_pairs
33+
Sims1.find_if
34+
Sims1.first_long_rule_position
35+
Sims1.for_each
36+
Sims1.idle_thread_restarts
37+
Sims1.included_pairs
38+
Sims1.init
39+
Sims1.iterator
40+
Sims1.long_rule_length
41+
Sims1.long_rules
42+
Sims1.number_of_congruences
43+
Sims1.number_of_long_rules
44+
Sims1.number_of_threads
45+
Sims1.presentation
46+
Sims1.pruners
47+
Sims1.stats
48+
49+
Full API
50+
--------
51+
52+
.. TODO(0) document __init__ directly, the same trick that works for RepOrc +
53+
MinimalRepOrc doesn't work here for some reason.
54+
55+
.. autoclass:: Sims1
56+
:class-doc-from: init
57+
:members:
58+
:inherited-members:
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
.. Copyright (c) 2025 J. D. Mitchell
2+
3+
Distributed under the terms of the GPL license version 3.
4+
5+
The full license is in the file LICENSE, distributed with this software.
6+
7+
.. currentmodule:: _libsemigroups_pybind11
8+
9+
The Sims2 class
10+
===============
11+
12+
.. autoclass:: Sims2
13+
:doc-only:
14+
:class-doc-from: class
15+
16+
17+
Contents
18+
--------
19+
20+
.. autosummary::
21+
:nosignatures:
22+
23+
~Sims2
24+
Sims2.add_excluded_pair
25+
Sims2.add_included_pair
26+
Sims2.add_pruner
27+
Sims2.clear_excluded_pairs
28+
Sims2.clear_included_pairs
29+
Sims2.clear_long_rules
30+
Sims2.clear_pruners
31+
Sims2.copy
32+
Sims2.excluded_pairs
33+
Sims2.find_if
34+
Sims2.first_long_rule_position
35+
Sims2.for_each
36+
Sims2.idle_thread_restarts
37+
Sims2.included_pairs
38+
Sims2.init
39+
Sims2.iterator
40+
Sims2.long_rule_length
41+
Sims2.long_rules
42+
Sims2.number_of_congruences
43+
Sims2.number_of_long_rules
44+
Sims2.number_of_threads
45+
Sims2.presentation
46+
Sims2.pruners
47+
Sims2.stats
48+
49+
Full API
50+
--------
51+
52+
.. TODO(0) document __init__ directly, the same trick that works for RepOrc +
53+
MinimalRepOrc doesn't work here for some reason.
54+
55+
.. autoclass:: Sims2
56+
:class-doc-from: init
57+
:members:
58+
:inherited-members:
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
.. Copyright (c) 2025 J. D. Mitchell
2+
3+
Distributed under the terms of the GPL license version 3.
4+
5+
The full license is in the file LICENSE, distributed with this software.
6+
7+
.. currentmodule:: _libsemigroups_pybind11
8+
9+
The SimsRefinerFaithful class
10+
=============================
11+
12+
.. autoclass:: SimsRefinerFaithful
13+
:doc-only:
14+
:class-doc-from: class
15+
16+
Contents
17+
--------
18+
19+
.. autosummary::
20+
:nosignatures:
21+
22+
~SimsRefinerFaithful
23+
SimsRefinerFaithful.__init__
24+
SimsRefinerFaithful.__call__
25+
SimsRefinerFaithful.forbid
26+
SimsRefinerFaithful.init
27+
28+
Full API
29+
--------
30+
31+
.. autoclass:: SimsRefinerFaithful
32+
:no-doc:
33+
:class-doc-from: class
34+
:members:
35+
:inherited-members:
36+
:special-members: __call__, __init__

0 commit comments

Comments
 (0)