Skip to content

Commit 5a22cce

Browse files
author
Release Manager
committed
gh-36643: `sage.combinat.species`: Update `# needs` <!-- ^^^^^ Please provide a concise, informative and self-explanatory title. Don't put issue numbers in there, do this in the PR body below. For example, instead of "Fixes #1234" use "Introduce new method to calculate 1+1" --> <!-- Describe your changes here in detail --> <!-- Why is this change required? What problem does it solve? --> <!-- If this PR resolves an open issue, please link to it here. For example "Fixes #12345". --> - Cherry-picked from #35095 <!-- If your change requires a documentation PR, please link it appropriately. --> ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> <!-- If your change requires a documentation PR, please link it appropriately --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> <!-- Feel free to remove irrelevant items. --> - [ ] The title is concise, informative, and self-explanatory. - [ ] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on - #12345: short description why this is a dependency - #34567: ... --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: #36643 Reported by: Matthias Köppe Reviewer(s): David Coudert
2 parents 91c9fa6 + 81dfb7b commit 5a22cce

18 files changed

+203
-190
lines changed

src/sage/combinat/species/characteristic_species.py

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,15 @@ def canonical_label(self):
6060

6161
def transport(self, perm):
6262
"""
63-
Returns the transport of this structure along the permutation
64-
perm.
63+
Return the transport of this structure along the permutation ``perm``.
6564
6665
EXAMPLES::
6766
6867
sage: F = species.CharacteristicSpecies(3)
6968
sage: a = F.structures(["a", "b", "c"]).random_element(); a
7069
{'a', 'b', 'c'}
71-
sage: p = PermutationGroupElement((1,2))
72-
sage: a.transport(p)
70+
sage: p = PermutationGroupElement((1,2)) # needs sage.groups
71+
sage: a.transport(p) # needs sage.groups
7372
{'a', 'b', 'c'}
7473
"""
7574
return self
@@ -85,7 +84,7 @@ def automorphism_group(self):
8584
sage: F = species.CharacteristicSpecies(3)
8685
sage: a = F.structures(["a", "b", "c"]).random_element(); a
8786
{'a', 'b', 'c'}
88-
sage: a.automorphism_group()
87+
sage: a.automorphism_group() # needs sage.groups
8988
Symmetric group of order 3! as a permutation group
9089
"""
9190
from sage.groups.perm_gps.permgroup_named import SymmetricGroup
@@ -111,7 +110,7 @@ def __init__(self, n, min=None, max=None, weight=None):
111110
[0, 1, 0, 0]
112111
sage: X.isotype_generating_series()[0:4]
113112
[0, 1, 0, 0]
114-
sage: X.cycle_index_series()[0:4]
113+
sage: X.cycle_index_series()[0:4] # needs sage.modules
115114
[0, p[1], 0, 0]
116115
117116
sage: F = species.CharacteristicSpecies(3)
@@ -204,8 +203,8 @@ def _cis_term(self, base_ring):
204203
EXAMPLES::
205204
206205
sage: F = species.CharacteristicSpecies(2)
207-
sage: g = F.cycle_index_series()
208-
sage: g[0:5]
206+
sage: g = F.cycle_index_series() # needs sage.modules
207+
sage: g[0:5] # needs sage.modules
209208
[0, 0, 1/2*p[1, 1] + 1/2*p[2], 0, 0]
210209
"""
211210
cis = SetSpecies(weight=self._weight).cycle_index_series(base_ring)
@@ -220,11 +219,11 @@ def _equation(self, var_mapping):
220219
EXAMPLES::
221220
222221
sage: C = species.CharacteristicSpecies(2)
223-
sage: Qz = QQ['z']
224-
sage: R.<node0> = Qz[]
225-
sage: var_mapping = {'z':Qz.gen(), 'node0':R.gen()}
226-
sage: C._equation(var_mapping)
227-
z^2
222+
sage: Qz = QQ['z']
223+
sage: R.<node0> = Qz[]
224+
sage: var_mapping = {'z':Qz.gen(), 'node0':R.gen()}
225+
sage: C._equation(var_mapping)
226+
z^2
228227
"""
229228
return var_mapping['z']**(self._n)
230229

@@ -252,7 +251,7 @@ def __init__(self, min=None, max=None, weight=None):
252251
[1, 0, 0, 0]
253252
sage: X.isotype_generating_series()[0:4]
254253
[1, 0, 0, 0]
255-
sage: X.cycle_index_series()[0:4]
254+
sage: X.cycle_index_series()[0:4] # needs sage.modules
256255
[p[], 0, 0, 0]
257256
258257
TESTS::
@@ -296,7 +295,7 @@ def __init__(self, min=None, max=None, weight=None):
296295
[0, 1, 0, 0]
297296
sage: X.isotype_generating_series()[0:4]
298297
[0, 1, 0, 0]
299-
sage: X.cycle_index_series()[0:4]
298+
sage: X.cycle_index_series()[0:4] # needs sage.modules
300299
[0, p[1], 0, 0]
301300
302301
TESTS::

src/sage/combinat/species/composition_species.py

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ def __init__(self, parent, labels, pi, f, gs):
2828
2929
sage: E = species.SetSpecies(); C = species.CycleSpecies()
3030
sage: L = E(C)
31-
sage: a = L.structures(['a','b','c']).random_element()
32-
sage: a == loads(dumps(a))
31+
sage: a = L.structures(['a','b','c']).random_element() # needs sage.libs.flint
32+
sage: a == loads(dumps(a)) # needs sage.libs.flint
3333
True
3434
"""
3535
self._partition = pi
@@ -41,7 +41,7 @@ def __repr__(self):
4141
4242
sage: E = species.SetSpecies(); C = species.CycleSpecies()
4343
sage: L = E(C)
44-
sage: L.structures(['a','b','c'])[0]
44+
sage: L.structures(['a','b','c'])[0] # needs sage.libs.flint
4545
F-structure: {{'a', 'b', 'c'}}; G-structures: (('a', 'b', 'c'),)
4646
"""
4747
f, gs = self._list
@@ -51,13 +51,13 @@ def transport(self, perm):
5151
"""
5252
EXAMPLES::
5353
54-
sage: p = PermutationGroupElement((2,3))
54+
sage: p = PermutationGroupElement((2,3)) # needs sage.groups
5555
sage: E = species.SetSpecies(); C = species.CycleSpecies()
5656
sage: L = E(C)
57-
sage: S = L.structures(['a','b','c']).list()
58-
sage: a = S[2]; a
57+
sage: S = L.structures(['a','b','c']).list() # needs sage.libs.flint
58+
sage: a = S[2]; a # needs sage.libs.flint
5959
F-structure: {{'a', 'c'}, {'b'}}; G-structures: (('a', 'c'), ('b'))
60-
sage: a.transport(p)
60+
sage: a.transport(p) # needs sage.groups sage.libs.flint
6161
F-structure: {{'a', 'b'}, {'c'}}; G-structures: (('a', 'c'), ('b'))
6262
"""
6363
f, gs = self._list
@@ -83,10 +83,10 @@ def change_labels(self, labels):
8383
8484
sage: E = species.SetSpecies(); C = species.CycleSpecies()
8585
sage: L = E(C)
86-
sage: S = L.structures(['a','b','c']).list()
87-
sage: a = S[2]; a
86+
sage: S = L.structures(['a','b','c']).list() # needs sage.libs.flint
87+
sage: a = S[2]; a # needs sage.libs.flint
8888
F-structure: {{'a', 'c'}, {'b'}}; G-structures: (('a', 'c'), ('b'))
89-
sage: a.change_labels([1,2,3])
89+
sage: a.change_labels([1,2,3]) # needs sage.libs.flint
9090
F-structure: {{1, 3}, {2}}; G-structures: [(1, 3), (2)]
9191
"""
9292
f, gs = self._list
@@ -116,7 +116,7 @@ def __init__(self, F, G, min=None, max=None, weight=None):
116116
sage: E = species.SetSpecies(); C = species.CycleSpecies()
117117
sage: L = E(C)
118118
sage: c = L.generating_series()[:3]
119-
sage: L._check() #False due to isomorphism types not being implemented
119+
sage: L._check() #False due to isomorphism types not being implemented # needs sage.libs.flint
120120
False
121121
sage: L == loads(dumps(L))
122122
True
@@ -135,7 +135,7 @@ def _structures(self, structure_class, labels):
135135
136136
sage: E = species.SetSpecies(); C = species.CycleSpecies()
137137
sage: L = E(C)
138-
sage: L.structures(['a','b','c']).list()
138+
sage: L.structures(['a','b','c']).list() # needs sage.libs.flint
139139
[F-structure: {{'a', 'b', 'c'}}; G-structures: (('a', 'b', 'c'),),
140140
F-structure: {{'a', 'b', 'c'}}; G-structures: (('a', 'c', 'b'),),
141141
F-structure: {{'a', 'c'}, {'b'}}; G-structures: (('a', 'c'), ('b')),
@@ -145,6 +145,7 @@ def _structures(self, structure_class, labels):
145145
146146
TESTS::
147147
148+
sage: # needs sage.libs.flint
148149
sage: a = _[2]
149150
sage: f, gs = a._list
150151
sage: f
@@ -180,7 +181,7 @@ def _isotypes(self, structure_class, labels):
180181
181182
sage: E = species.SetSpecies(); C = species.CycleSpecies()
182183
sage: L = E(C)
183-
sage: L.isotypes(['a','b','c']).list()
184+
sage: L.isotypes(['a','b','c']).list() # needs sage.modules
184185
Traceback (most recent call last):
185186
...
186187
NotImplementedError
@@ -204,7 +205,7 @@ def _itgs(self, series_ring, base_ring):
204205
205206
sage: E = species.SetSpecies(); C = species.CycleSpecies()
206207
sage: L = E(C)
207-
sage: L.isotype_generating_series()[:10]
208+
sage: L.isotype_generating_series()[:10] # needs sage.modules
208209
[1, 1, 2, 3, 5, 7, 11, 15, 22, 30]
209210
"""
210211
cis = self.cycle_index_series(base_ring)
@@ -216,7 +217,7 @@ def _cis(self, series_ring, base_ring):
216217
217218
sage: E = species.SetSpecies(); C = species.CycleSpecies()
218219
sage: L = E(C)
219-
sage: L.cycle_index_series()[:5]
220+
sage: L.cycle_index_series()[:5] # needs sage.modules
220221
[p[],
221222
p[1],
222223
p[1, 1] + p[2],
@@ -233,7 +234,7 @@ def _cis(self, series_ring, base_ring):
233234
sage: E = species.SetSpecies()
234235
sage: C = species.CycleSpecies(weight=t)
235236
sage: S = E(C)
236-
sage: S.isotype_generating_series()[:5] #indirect
237+
sage: S.isotype_generating_series()[:5] #indirect # needs sage.modules
237238
[1, t, t^2 + t, t^3 + t^2 + t, t^4 + t^3 + 2*t^2 + t]
238239
239240
We do the same thing with set partitions weighted by the number of
@@ -245,7 +246,7 @@ def _cis(self, series_ring, base_ring):
245246
sage: E = species.SetSpecies()
246247
sage: E_t = species.SetSpecies(min=1,weight=t)
247248
sage: Par = E(E_t)
248-
sage: Par.isotype_generating_series()[:5]
249+
sage: Par.isotype_generating_series()[:5] # needs sage.modules
249250
[1, t, t^2 + t, t^3 + t^2 + t, t^4 + t^3 + 2*t^2 + t]
250251
"""
251252
f_cis = self._F.cycle_index_series(base_ring)

src/sage/combinat/species/cycle_species.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def permutation_group_element(self):
5151
sage: F = species.CycleSpecies()
5252
sage: a = F.structures(["a", "b", "c"])[0]; a
5353
('a', 'b', 'c')
54-
sage: a.permutation_group_element()
54+
sage: a.permutation_group_element() # needs sage.groups
5555
(1,2,3)
5656
"""
5757
from sage.groups.perm_gps.constructor import PermutationGroupElement
@@ -67,8 +67,8 @@ def transport(self, perm):
6767
sage: F = species.CycleSpecies()
6868
sage: a = F.structures(["a", "b", "c"])[0]; a
6969
('a', 'b', 'c')
70-
sage: p = PermutationGroupElement((1,2))
71-
sage: a.transport(p)
70+
sage: p = PermutationGroupElement((1,2)) # needs sage.groups
71+
sage: a.transport(p) # needs sage.groups
7272
('a', 'c', 'b')
7373
"""
7474
p = self.permutation_group_element()
@@ -88,12 +88,12 @@ def automorphism_group(self):
8888
sage: P = species.CycleSpecies()
8989
sage: a = P.structures([1, 2, 3, 4])[0]; a
9090
(1, 2, 3, 4)
91-
sage: a.automorphism_group()
91+
sage: a.automorphism_group() # needs sage.groups
9292
Permutation Group with generators [(1,2,3,4)]
9393
9494
::
9595
96-
sage: [a.transport(perm) for perm in a.automorphism_group()]
96+
sage: [a.transport(perm) for perm in a.automorphism_group()] # needs sage.groups
9797
[(1, 2, 3, 4), (1, 2, 3, 4), (1, 2, 3, 4), (1, 2, 3, 4)]
9898
"""
9999
from sage.groups.perm_gps.permgroup_named import SymmetricGroup
@@ -255,8 +255,8 @@ def _cis_callable(self, base_ring, n):
255255
EXAMPLES::
256256
257257
sage: P = species.CycleSpecies()
258-
sage: cis = P.cycle_index_series()
259-
sage: cis[0:7]
258+
sage: cis = P.cycle_index_series() # needs sage.modules
259+
sage: cis[0:7] # needs sage.modules
260260
[0,
261261
p[1],
262262
1/2*p[1, 1] + 1/2*p[2],

src/sage/combinat/species/empty_species.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class EmptySpecies(GenericCombinatorialSpecies, UniqueRepresentation):
3838
[0, 0, 0, 0]
3939
sage: X.isotype_generating_series()[0:4]
4040
[0, 0, 0, 0]
41-
sage: X.cycle_index_series()[0:4]
41+
sage: X.cycle_index_series()[0:4] # needs sage.modules
4242
[0, 0, 0, 0]
4343
4444
The empty species is the zero of the semi-ring of species.
@@ -55,7 +55,7 @@ class EmptySpecies(GenericCombinatorialSpecies, UniqueRepresentation):
5555
sage: (X.isotype_generating_series()[0:4] ==
5656
....: S.isotype_generating_series()[0:4])
5757
True
58-
sage: (X.cycle_index_series()[0:4] ==
58+
sage: (X.cycle_index_series()[0:4] == # needs sage.modules
5959
....: S.cycle_index_series()[0:4])
6060
True
6161
@@ -69,7 +69,7 @@ class EmptySpecies(GenericCombinatorialSpecies, UniqueRepresentation):
6969
[0, 0, 0, 0]
7070
sage: Y.isotype_generating_series()[0:4]
7171
[0, 0, 0, 0]
72-
sage: Y.cycle_index_series()[0:4]
72+
sage: Y.cycle_index_series()[0:4] # needs sage.modules
7373
[0, 0, 0, 0]
7474
7575
TESTS::

src/sage/combinat/species/functorial_composition_species.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def __init__(self, F, G, min=None, max=None, weight=None):
3535
sage: WP = species.SubsetSpecies()
3636
sage: P2 = E2*E
3737
sage: G = WP.functorial_composition(P2)
38-
sage: G.isotype_generating_series()[0:5]
38+
sage: G.isotype_generating_series()[0:5] # needs sage.modules
3939
[1, 1, 2, 4, 11]
4040
4141
sage: G = species.SimpleGraphSpecies()
@@ -44,7 +44,7 @@ def __init__(self, F, G, min=None, max=None, weight=None):
4444
<class 'sage.combinat.species.functorial_composition_species.FunctorialCompositionSpecies'>
4545
sage: G == loads(dumps(G))
4646
True
47-
sage: G._check() #False due to isomorphism types not being implemented
47+
sage: G._check() # False due to isomorphism types not being implemented # needs sage.modules
4848
False
4949
"""
5050
self._F = F
@@ -81,7 +81,7 @@ def _isotypes(self, structure_class, s):
8181
EXAMPLES::
8282
8383
sage: G = species.SimpleGraphSpecies()
84-
sage: G.isotypes([1,2,3]).list()
84+
sage: G.isotypes([1,2,3]).list() # needs sage.modules
8585
Traceback (most recent call last):
8686
...
8787
NotImplementedError
@@ -103,7 +103,7 @@ def _itgs(self, series_ring, base_ring):
103103
EXAMPLES::
104104
105105
sage: G = species.SimpleGraphSpecies()
106-
sage: G.isotype_generating_series()[0:5]
106+
sage: G.isotype_generating_series()[0:5] # needs sage.modules
107107
[1, 1, 2, 4, 11]
108108
"""
109109
return self.cycle_index_series(base_ring).isotype_generating_series()
@@ -113,7 +113,7 @@ def _cis(self, series_ring, base_ring):
113113
EXAMPLES::
114114
115115
sage: G = species.SimpleGraphSpecies()
116-
sage: G.cycle_index_series()[0:5]
116+
sage: G.cycle_index_series()[0:5] # needs sage.modules
117117
[p[],
118118
p[1],
119119
p[1, 1] + p[2],

0 commit comments

Comments
 (0)