From 0b39a2b72da015f0b49b0c59c7d6c75582587736 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 3 Jun 2023 16:59:56 -0700 Subject: [PATCH 1/8] sage.combinat: Modularization fixes --- src/sage/combinat/species/generating_series.py | 7 ++++--- src/sage/combinat/species/misc.py | 12 +++++++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/sage/combinat/species/generating_series.py b/src/sage/combinat/species/generating_series.py index e7f7c8ee978..3d7e7e81341 100644 --- a/src/sage/combinat/species/generating_series.py +++ b/src/sage/combinat/species/generating_series.py @@ -53,11 +53,12 @@ from sage.rings.lazy_series_ring import LazyPowerSeriesRing, LazySymmetricFunctions from sage.rings.integer import Integer from sage.rings.rational_field import QQ -from sage.arith.misc import divisors +from sage.arith.misc import divisors, factorial from sage.combinat.partition import Partition, Partitions -from sage.combinat.sf.sf import SymmetricFunctions from sage.misc.cachefunc import cached_function -from sage.arith.misc import factorial +from sage.misc.lazy_import import lazy_import + +lazy_import('sage.combinat.sf.sf', 'SymmetricFunctions') class OrdinaryGeneratingSeries(LazyPowerSeries): diff --git a/src/sage/combinat/species/misc.py b/src/sage/combinat/species/misc.py index a516beb56ae..12a9b2c8f70 100644 --- a/src/sage/combinat/species/misc.py +++ b/src/sage/combinat/species/misc.py @@ -17,13 +17,15 @@ # http://www.gnu.org/licenses/ #***************************************************************************** -from sage.groups.perm_gps.permgroup import PermutationGroup -from sage.groups.perm_gps.permgroup import PermutationGroup_generic -from sage.groups.perm_gps.constructor import PermutationGroupElement -from sage.groups.perm_gps.permgroup_named import SymmetricGroup -from sage.misc.misc_c import prod from functools import wraps +from sage.misc.misc_c import prod +from sage.misc.lazy_import import lazy_import + +lazy_import('sage.groups.perm_gps.permgroup', ['PermutationGroup', 'PermutationGroup_generic']) +lazy_import('sage.groups.perm_gps.constructor', 'PermutationGroupElement') +lazy_import('sage.groups.perm_gps.permgroup_named', 'SymmetricGroup') + def change_support(perm, support, change_perm=None): """ From c934842512612d049daf34902e30e4da365515fb Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 8 Jun 2023 18:33:43 -0700 Subject: [PATCH 2/8] sage.combinat: More # optional --- .../combinat/species/generating_series.py | 56 +++++++++---------- src/sage/combinat/species/library.py | 12 ++-- .../combinat/species/recursive_species.py | 12 ++-- 3 files changed, 40 insertions(+), 40 deletions(-) diff --git a/src/sage/combinat/species/generating_series.py b/src/sage/combinat/species/generating_series.py index 3d7e7e81341..88358916946 100644 --- a/src/sage/combinat/species/generating_series.py +++ b/src/sage/combinat/species/generating_series.py @@ -17,7 +17,7 @@ sage: from sage.combinat.species.generating_series import CycleIndexSeriesRing sage: p = SymmetricFunctions(QQ).power() # optional - sage.modules - sage: CIS = CycleIndexSeriesRing(QQ) + sage: CIS = CycleIndexSeriesRing(QQ) # optional - sage.modules sage: geo1 = CIS(lambda i: p([1])^i) # optional - sage.modules sage: geo2 = CIS(lambda i: p([2])^(i // 2) if is_even(i) else 0) # optional - sage.modules sage: s = geo1 * geo2 # optional - sage.modules @@ -294,7 +294,7 @@ def count(self, t): sage: from sage.combinat.species.generating_series import CycleIndexSeriesRing sage: p = SymmetricFunctions(QQ).power() # optional - sage.modules - sage: CIS = CycleIndexSeriesRing(QQ) + sage: CIS = CycleIndexSeriesRing(QQ) # optional - sage.modules sage: f = CIS([0, p([1]), 2*p([1,1]), 3*p([2,1])]) # optional - sage.modules sage: f.count([1]) # optional - sage.modules 1 @@ -314,7 +314,7 @@ def coefficient_cycle_type(self, t): sage: from sage.combinat.species.generating_series import CycleIndexSeriesRing sage: p = SymmetricFunctions(QQ).power() # optional - sage.modules - sage: CIS = CycleIndexSeriesRing(QQ) + sage: CIS = CycleIndexSeriesRing(QQ) # optional - sage.modules sage: f = CIS([0, p([1]), 2*p([1,1]),3*p([2,1])]) # optional - sage.modules sage: f.coefficient_cycle_type([1]) # optional - sage.modules 1 @@ -334,9 +334,9 @@ def isotype_generating_series(self): EXAMPLES:: sage: P = species.PermutationSpecies() - sage: cis = P.cycle_index_series() - sage: f = cis.isotype_generating_series() - sage: f[:10] + sage: cis = P.cycle_index_series() # optional - sage.modules + sage: f = cis.isotype_generating_series() # optional - sage.modules + sage: f[:10] # optional - sage.modules [1, 1, 2, 3, 5, 7, 11, 15, 22, 30] """ R = self.base_ring() @@ -352,8 +352,8 @@ def _ogs_gen(self, n, ao): EXAMPLES:: sage: P = species.PermutationSpecies() - sage: cis = P.cycle_index_series() - sage: [cis._ogs_gen(i, 0) for i in range(10)] + sage: cis = P.cycle_index_series() # optional - sage.modules + sage: [cis._ogs_gen(i, 0) for i in range(10)] # optional - sage.modules [1, 1, 2, 3, 5, 7, 11, 15, 22, 30] """ if n < ao: @@ -367,9 +367,9 @@ def generating_series(self): EXAMPLES:: sage: P = species.PartitionSpecies() - sage: cis = P.cycle_index_series() - sage: f = cis.generating_series() - sage: f[:5] + sage: cis = P.cycle_index_series() # optional - sage.modules + sage: f = cis.generating_series() # optional - sage.modules + sage: f[:5] # optional - sage.modules [1, 1, 1, 5/6, 5/8] """ R = self.base_ring() @@ -385,8 +385,8 @@ def _egs_gen(self, n, ao): EXAMPLES:: sage: P = species.PermutationSpecies() - sage: cis = P.cycle_index_series() - sage: [cis._egs_gen(i, 0) for i in range(10)] + sage: cis = P.cycle_index_series() # optional - sage.modules + sage: [cis._egs_gen(i, 0) for i in range(10)] # optional - sage.modules [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] """ if n < ao: @@ -409,16 +409,16 @@ def derivative(self, n=1): The species `E` of sets satisfies the relationship `E' = E`:: - sage: E = species.SetSpecies().cycle_index_series() - sage: E[:8] == E.derivative()[:8] + sage: E = species.SetSpecies().cycle_index_series() # optional - sage.modules + sage: E[:8] == E.derivative()[:8] # optional - sage.modules True The species `C` of cyclic orderings and the species `L` of linear orderings satisfy the relationship `C' = L`:: - sage: C = species.CycleSpecies().cycle_index_series() - sage: L = species.LinearOrderSpecies().cycle_index_series() - sage: L[:8] == C.derivative()[:8] + sage: C = species.CycleSpecies().cycle_index_series() # optional - sage.modules + sage: L = species.LinearOrderSpecies().cycle_index_series() # optional - sage.modules + sage: L[:8] == C.derivative()[:8] # optional - sage.modules True """ return self.derivative_with_respect_to_p1(n=n) @@ -439,9 +439,9 @@ def pointing(self): The species `E^{\bullet}` of "pointed sets" satisfies `E^{\bullet} = X \cdot E`:: - sage: E = species.SetSpecies().cycle_index_series() - sage: X = species.SingletonSpecies().cycle_index_series() - sage: E.pointing()[:8] == (X*E)[:8] + sage: E = species.SetSpecies().cycle_index_series() # optional - sage.modules + sage: X = species.SingletonSpecies().cycle_index_series() # optional - sage.modules + sage: E.pointing()[:8] == (X*E)[:8] # optional - sage.modules True """ X = self.parent()([1], valuation=1) @@ -463,9 +463,9 @@ def exponential(self): Let `BT` be the species of binary trees, `BF` the species of binary forests, and `E` the species of sets. Then we have `BF = E \circ BT`:: - sage: BT = species.BinaryTreeSpecies().cycle_index_series() - sage: BF = species.BinaryForestSpecies().cycle_index_series() - sage: BT.exponential().isotype_generating_series()[:8] == BF.isotype_generating_series()[:8] + sage: BT = species.BinaryTreeSpecies().cycle_index_series() # optional - sage.modules + sage: BF = species.BinaryForestSpecies().cycle_index_series() # optional - sage.modules + sage: BT.exponential().isotype_generating_series()[:8] == BF.isotype_generating_series()[:8] # optional - sage.modules True """ base_ring = self.parent().base_ring().base_ring() @@ -490,10 +490,10 @@ def logarithm(self): Let `G` be the species of nonempty graphs and `CG` be the species of nonempty connected graphs. Then `G = E^{+} \circ CG`, so `CG = \Omega \circ G`:: - sage: G = species.SimpleGraphSpecies().cycle_index_series() - 1 + sage: G = species.SimpleGraphSpecies().cycle_index_series() - 1 # optional - sage.modules sage: from sage.combinat.species.generating_series import LogarithmCycleIndexSeries - sage: CG = LogarithmCycleIndexSeries()(G) - sage: CG.isotype_generating_series()[0:8] + sage: CG = LogarithmCycleIndexSeries()(G) # optional - sage.modules + sage: CG.isotype_generating_series()[0:8] # optional - sage.modules [0, 1, 1, 2, 6, 21, 112, 853] """ base_ring = self.parent().base_ring().base_ring() @@ -546,7 +546,7 @@ class CycleIndexSeriesRing(LazySymmetricFunctions): We test to make sure that caching works:: - sage: R is CycleIndexSeriesRing(QQ) + sage: R is CycleIndexSeriesRing(QQ) # optional - sage.modules True """ Element = CycleIndexSeries diff --git a/src/sage/combinat/species/library.py b/src/sage/combinat/species/library.py index d4235273a9f..e9f7cf0c734 100644 --- a/src/sage/combinat/species/library.py +++ b/src/sage/combinat/species/library.py @@ -43,7 +43,7 @@ def SimpleGraphSpecies(): sage: S = species.SimpleGraphSpecies() sage: S.generating_series().counts(10) [1, 1, 2, 8, 64, 1024, 32768, 2097152, 268435456, 68719476736] - sage: S.cycle_index_series()[:5] + sage: S.cycle_index_series()[:5] # optional - sage.modules [p[], p[1], p[1, 1] + p[2], @@ -94,7 +94,7 @@ def BinaryTreeSpecies(): sage: B = species.BinaryTreeSpecies() sage: a = B.structures([1,2,3,4,5])[187]; a 2*((5*3)*(4*1)) - sage: a.automorphism_group() + sage: a.automorphism_group() # optional - sage.groups Permutation Group with generators [()] TESTS:: @@ -121,9 +121,9 @@ def BinaryForestSpecies(): sage: F = species.BinaryForestSpecies() sage: F.generating_series().counts(10) [1, 1, 3, 19, 193, 2721, 49171, 1084483, 28245729, 848456353] - sage: F.isotype_generating_series().counts(10) + sage: F.isotype_generating_series().counts(10) # optional - sage.modules [1, 1, 2, 4, 10, 26, 77, 235, 758, 2504] - sage: F.cycle_index_series()[:7] + sage: F.cycle_index_series()[:7] # optional - sage.modules [p[], p[1], 3/2*p[1, 1] + 1/2*p[2], @@ -134,8 +134,8 @@ def BinaryForestSpecies(): TESTS:: - sage: seq = F.isotype_generating_series().counts(10)[1:] - sage: oeis(seq)[0] # optional -- internet + sage: seq = F.isotype_generating_series().counts(10)[1:] # optional - sage.modules + sage: oeis(seq)[0] # optional -- internet # optional - sage.modules A052854: Number of forests of ordered trees on n total nodes. """ B = BinaryTreeSpecies() diff --git a/src/sage/combinat/species/recursive_species.py b/src/sage/combinat/species/recursive_species.py index 3cd073f9f9c..a87bb27866b 100644 --- a/src/sage/combinat/species/recursive_species.py +++ b/src/sage/combinat/species/recursive_species.py @@ -263,7 +263,7 @@ def _cis(self, series_ring, base_ring): EXAMPLES:: sage: F = CombinatorialSpecies() - sage: F.cycle_index_series() + sage: F.cycle_index_series() # optional - sage.modules Uninitialized Lazy Series """ if base_ring not in self._cycle_index_series: @@ -429,17 +429,17 @@ def _add_to_digraph(self, d): EXAMPLES:: - sage: d = DiGraph(multiedges=True) + sage: d = DiGraph(multiedges=True) # optional - sage.graphs sage: X = species.SingletonSpecies() sage: B = species.CombinatorialSpecies() sage: B.define(X+B*B) - sage: B._add_to_digraph(d); d + sage: B._add_to_digraph(d); d # optional - sage.graphs Multi-digraph on 4 vertices TESTS:: sage: C = species.CombinatorialSpecies() - sage: C._add_to_digraph(d) + sage: C._add_to_digraph(d) # optional - sage.graphs Traceback (most recent call last): ... NotImplementedError @@ -461,7 +461,7 @@ def _equation(self, var_mapping): EXAMPLES:: sage: C = species.CombinatorialSpecies() - sage: C.algebraic_equation_system() + sage: C.algebraic_equation_system() # optional - sage.graphs Traceback (most recent call last): ... NotImplementedError @@ -469,7 +469,7 @@ def _equation(self, var_mapping): :: sage: B = species.BinaryTreeSpecies() - sage: B.algebraic_equation_system() + sage: B.algebraic_equation_system() # optional - sage.graphs [-node3^2 + node1, -node1 + node3 + (-z)] """ try: From 36ee07472a1a2246e77f4d3b71b54280ca74dc00 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 9 Jun 2023 00:55:41 -0700 Subject: [PATCH 3/8] More # optional --- .../combinat/species/generating_series.py | 4 +- src/sage/combinat/species/library.py | 10 ++-- .../combinat/species/permutation_species.py | 6 +-- src/sage/combinat/species/product_species.py | 30 ++++++------ src/sage/combinat/species/set_species.py | 10 ++-- src/sage/combinat/species/species.py | 48 ++++++++++--------- src/sage/combinat/species/subset_species.py | 14 +++--- src/sage/combinat/species/sum_species.py | 4 +- 8 files changed, 65 insertions(+), 61 deletions(-) diff --git a/src/sage/combinat/species/generating_series.py b/src/sage/combinat/species/generating_series.py index 88358916946..24830b17bcd 100644 --- a/src/sage/combinat/species/generating_series.py +++ b/src/sage/combinat/species/generating_series.py @@ -669,8 +669,8 @@ def LogarithmCycleIndexSeries(R=QQ): (that is, that composition with `E^{+}` in both directions yields the multiplicative identity `X`):: - sage: Eplus = sage.combinat.species.set_species.SetSpecies(min=1).cycle_index_series() - sage: LogarithmCycleIndexSeries()(Eplus)[0:4] # optional - sage.modules + sage: Eplus = sage.combinat.species.set_species.SetSpecies(min=1).cycle_index_series() # optional - sage.modules + sage: LogarithmCycleIndexSeries()(Eplus)[0:4] # optional - sage.modules [0, p[1], 0, 0] """ CIS = CycleIndexSeriesRing(R) diff --git a/src/sage/combinat/species/library.py b/src/sage/combinat/species/library.py index e9f7cf0c734..3e3025d87f6 100644 --- a/src/sage/combinat/species/library.py +++ b/src/sage/combinat/species/library.py @@ -49,19 +49,19 @@ def SimpleGraphSpecies(): p[1, 1] + p[2], 4/3*p[1, 1, 1] + 2*p[2, 1] + 2/3*p[3], 8/3*p[1, 1, 1, 1] + 4*p[2, 1, 1] + 2*p[2, 2] + 4/3*p[3, 1] + p[4]] - sage: S.isotype_generating_series()[:6] + sage: S.isotype_generating_series()[:6] # optional - sage.modules [1, 1, 2, 4, 11, 34] TESTS:: - sage: seq = S.isotype_generating_series().counts(6)[1:] - sage: oeis(seq)[0] # optional -- internet + sage: seq = S.isotype_generating_series().counts(6)[1:] # optional - sage.modules + sage: oeis(seq)[0] # optional -- internet # optional - sage.modules A000088: Number of graphs on n unlabeled nodes. :: - sage: seq = S.generating_series().counts(10)[1:] - sage: oeis(seq)[0] # optional -- internet + sage: seq = S.generating_series().counts(10)[1:] # optional - sage.modules + sage: oeis(seq)[0] # optional -- internet # optional - sage.modules A006125: a(n) = 2^(n*(n-1)/2). """ E = SetSpecies() diff --git a/src/sage/combinat/species/permutation_species.py b/src/sage/combinat/species/permutation_species.py index 64534c9e8bb..470a766a2c4 100644 --- a/src/sage/combinat/species/permutation_species.py +++ b/src/sage/combinat/species/permutation_species.py @@ -225,8 +225,8 @@ def _cis(self, series_ring, base_ring): EXAMPLES:: sage: P = species.PermutationSpecies() - sage: g = P.cycle_index_series() - sage: g[0:5] + sage: g = P.cycle_index_series() # optional - sage.modules + sage: g[0:5] # optional - sage.modules [p[], p[1], p[1, 1] + p[2], @@ -244,7 +244,7 @@ def _cis_gen(self, base_ring, m, n): EXAMPLES:: sage: P = species.PermutationSpecies() - sage: [P._cis_gen(QQ, 2, i) for i in range(10)] + sage: [P._cis_gen(QQ, 2, i) for i in range(10)] # optional - sage.modules [p[], 0, p[2], 0, p[2, 2], 0, p[2, 2, 2], 0, p[2, 2, 2, 2], 0] """ from sage.combinat.sf.sf import SymmetricFunctions diff --git a/src/sage/combinat/species/product_species.py b/src/sage/combinat/species/product_species.py index 0989d2a8f8c..a3bcb3f4bb4 100644 --- a/src/sage/combinat/species/product_species.py +++ b/src/sage/combinat/species/product_species.py @@ -58,12 +58,12 @@ def transport(self, perm): """ EXAMPLES:: - sage: p = PermutationGroupElement((2,3)) - sage: S = species.SetSpecies() - sage: F = S * S - sage: a = F.structures(['a','b','c'])[4]; a + sage: p = PermutationGroupElement((2,3)) # optional - sage.groups + sage: S = species.SetSpecies() # optional - sage.groups + sage: F = S * S # optional - sage.groups + sage: a = F.structures(['a','b','c'])[4]; a # optional - sage.groups {'a', 'b'}*{'c'} - sage: a.transport(p) + sage: a.transport(p) # optional - sage.groups {'a', 'c'}*{'b'} """ left, right = self._list @@ -151,17 +151,17 @@ def automorphism_group(self): """ EXAMPLES:: - sage: p = PermutationGroupElement((2,3)) - sage: S = species.SetSpecies() - sage: F = S * S - sage: a = F.structures([1,2,3,4])[1]; a + sage: p = PermutationGroupElement((2,3)) # optional - sage.groups + sage: S = species.SetSpecies() # optional - sage.groups + sage: F = S * S # optional - sage.groups + sage: a = F.structures([1,2,3,4])[1]; a # optional - sage.groups {1}*{2, 3, 4} - sage: a.automorphism_group() + sage: a.automorphism_group() # optional - sage.groups Permutation Group with generators [(2,3), (2,3,4)] :: - sage: [a.transport(g) for g in a.automorphism_group()] + sage: [a.transport(g) for g in a.automorphism_group()] # optional - sage.groups [{1}*{2, 3, 4}, {1}*{2, 3, 4}, {1}*{2, 3, 4}, @@ -171,9 +171,9 @@ def automorphism_group(self): :: - sage: a = F.structures([1,2,3,4])[8]; a + sage: a = F.structures([1,2,3,4])[8]; a # optional - sage.groups {2, 3}*{1, 4} - sage: [a.transport(g) for g in a.automorphism_group()] + sage: [a.transport(g) for g in a.automorphism_group()] # optional - sage.groups [{2, 3}*{1, 4}, {2, 3}*{1, 4}, {2, 3}*{1, 4}, {2, 3}*{1, 4}] """ from sage.groups.perm_gps.constructor import PermutationGroupElement @@ -355,7 +355,7 @@ def _cis(self, series_ring, base_ring): sage: P = species.PermutationSpecies() sage: F = P * P - sage: F.cycle_index_series()[0:5] + sage: F.cycle_index_series()[0:5] # optional - sage.modules [p[], 2*p[1], 3*p[1, 1] + 2*p[2], @@ -409,7 +409,7 @@ def _equation(self, var_mapping): sage: X = species.SingletonSpecies() sage: S = X * X - sage: S.algebraic_equation_system() + sage: S.algebraic_equation_system() # optional - sage.graphs [node0 + (-z^2)] """ from sage.misc.misc_c import prod diff --git a/src/sage/combinat/species/set_species.py b/src/sage/combinat/species/set_species.py index daa7d7e5835..31020f8eb5e 100644 --- a/src/sage/combinat/species/set_species.py +++ b/src/sage/combinat/species/set_species.py @@ -57,8 +57,8 @@ def transport(self, perm): sage: F = species.SetSpecies() sage: a = F.structures(["a", "b", "c"]).random_element(); a {'a', 'b', 'c'} - sage: p = PermutationGroupElement((1,2)) - sage: a.transport(p) + sage: p = PermutationGroupElement((1,2)) # optional - sage.groups + sage: a.transport(p) # optional - sage.groups {'a', 'b', 'c'} """ return self @@ -74,7 +74,7 @@ def automorphism_group(self): sage: F = species.SetSpecies() sage: a = F.structures(["a", "b", "c"]).random_element(); a {'a', 'b', 'c'} - sage: a.automorphism_group() + sage: a.automorphism_group() # optional - sage.groups Symmetric group of order 3! as a permutation group """ from sage.groups.perm_gps.permgroup_named import SymmetricGroup @@ -170,8 +170,8 @@ def _cis(self, series_ring, base_ring): EXAMPLES:: sage: S = species.SetSpecies() - sage: g = S.cycle_index_series() - sage: g[0:5] + sage: g = S.cycle_index_series() # optional - sage.modules + sage: g[0:5] # optional - sage.modules [p[], p[1], 1/2*p[1, 1] + 1/2*p[2], diff --git a/src/sage/combinat/species/species.py b/src/sage/combinat/species/species.py index 4cd3403ae61..9c3365f81b7 100644 --- a/src/sage/combinat/species/species.py +++ b/src/sage/combinat/species/species.py @@ -24,12 +24,12 @@ sage: L = species.LinearOrderSpecies(min=1) sage: T = species.CombinatorialSpecies(min=1) sage: T.define(leaf + internal_node*L(T)) - sage: T.isotype_generating_series()[0:6] + sage: T.isotype_generating_series()[0:6] # optional - sage.modules [0, 1, q, q^2 + q, q^3 + 3*q^2 + q, q^4 + 6*q^3 + 6*q^2 + q] Consider the following:: - sage: T.isotype_generating_series().coefficient(4) + sage: T.isotype_generating_series().coefficient(4) # optional - sage.modules q^3 + 3*q^2 + q This means that, among the trees on `4` nodes, one has a @@ -335,7 +335,7 @@ def functorial_composition(self, g): sage: WP = species.SubsetSpecies() sage: P2 = E2*E sage: G = WP.functorial_composition(P2) - sage: G.isotype_generating_series()[0:5] + sage: G.isotype_generating_series()[0:5] # optional - sage.modules [1, 1, 2, 4, 11] """ from .functorial_composition_species import FunctorialCompositionSpecies @@ -448,7 +448,7 @@ def __pow__(self, n): sage: X^1 is X True sage: A = X^32 - sage: A.digraph() + sage: A.digraph() # optional - sage.graphs Multi-digraph on 6 vertices TESTS:: @@ -643,8 +643,8 @@ def cycle_index_series(self, base_ring=None): EXAMPLES:: sage: P = species.PermutationSpecies() - sage: g = P.cycle_index_series() - sage: g[0:4] + sage: g = P.cycle_index_series() # optional - sage.modules + sage: g[0:4] # optional - sage.modules [p[], p[1], p[1, 1] + p[2], p[1, 1, 1] + p[2, 1] + p[3]] """ return self._get_series(CycleIndexSeriesRing, "cis", base_ring) @@ -710,19 +710,19 @@ def digraph(self): sage: X = species.SingletonSpecies() sage: B = species.CombinatorialSpecies() sage: B.define(X+B*B) - sage: g = B.digraph(); g + sage: g = B.digraph(); g # optional - sage.graphs Multi-digraph on 4 vertices - sage: sorted(g, key=str) + sage: sorted(g, key=str) # optional - sage.graphs [Combinatorial species, Product of (Combinatorial species) and (Combinatorial species), Singleton species, Sum of (Singleton species) and (Product of (Combinatorial species) and (Combinatorial species))] - sage: d = {sp: i for i, sp in enumerate(g)} - sage: g.relabel(d) - sage: g.canonical_label().edges(sort=True) + sage: d = {sp: i for i, sp in enumerate(g)} # optional - sage.graphs + sage: g.relabel(d) # optional - sage.graphs + sage: g.canonical_label().edges(sort=True) # optional - sage.graphs [(0, 3, None), (2, 0, None), (2, 0, None), (3, 1, None), (3, 2, None)] """ from sage.graphs.digraph import DiGraph @@ -739,13 +739,13 @@ def _add_to_digraph(self, d): EXAMPLES:: - sage: d = DiGraph(multiedges=True) - sage: X = species.SingletonSpecies() - sage: X._add_to_digraph(d); d + sage: d = DiGraph(multiedges=True) # optional - sage.graphs + sage: X = species.SingletonSpecies() # optional - sage.graphs + sage: X._add_to_digraph(d); d # optional - sage.graphs Multi-digraph on 1 vertex - sage: (X+X)._add_to_digraph(d); d + sage: (X+X)._add_to_digraph(d); d # optional - sage.graphs Multi-digraph on 2 vertices - sage: d.edges(sort=True) + sage: d.edges(sort=True) # optional - sage.graphs [(Sum of (Singleton species) and (Singleton species), Singleton species, None), (Sum of (Singleton species) and (Singleton species), Singleton species, None)] """ @@ -770,21 +770,25 @@ def algebraic_equation_system(self): EXAMPLES:: sage: B = species.BinaryTreeSpecies() - sage: B.algebraic_equation_system() + sage: B.algebraic_equation_system() # optional - sage.graphs [-node3^2 + node1, -node1 + node3 + (-z)] :: - sage: sorted(B.digraph().vertex_iterator(), key=str) + sage: sorted(B.digraph().vertex_iterator(), key=str) # optional - sage.graphs [Combinatorial species with min=1, - Product of (Combinatorial species with min=1) and (Combinatorial species with min=1), + Product of (Combinatorial species with min=1) + and (Combinatorial species with min=1), Singleton species, - Sum of (Singleton species) and (Product of (Combinatorial species with min=1) and (Combinatorial species with min=1))] + Sum of (Singleton species) + and (Product of (Combinatorial species with min=1) + and (Combinatorial species with min=1))] :: - sage: B.algebraic_equation_system()[0].parent() - Multivariate Polynomial Ring in node0, node1, node2, node3 over Fraction Field of Univariate Polynomial Ring in z over Rational Field + sage: B.algebraic_equation_system()[0].parent() # optional - sage.graphs + Multivariate Polynomial Ring in node0, node1, node2, node3 over + Fraction Field of Univariate Polynomial Ring in z over Rational Field """ d = self.digraph() diff --git a/src/sage/combinat/species/subset_species.py b/src/sage/combinat/species/subset_species.py index 81156e5183d..2d3b9f8dcb6 100644 --- a/src/sage/combinat/species/subset_species.py +++ b/src/sage/combinat/species/subset_species.py @@ -74,11 +74,11 @@ def transport(self, perm): sage: F = species.SubsetSpecies() sage: a = F.structures(["a", "b", "c"])[5]; a {'a', 'c'} - sage: p = PermutationGroupElement((1,2)) - sage: a.transport(p) + sage: p = PermutationGroupElement((1,2)) # optional - sage.groups + sage: a.transport(p) # optional - sage.groups {'b', 'c'} - sage: p = PermutationGroupElement((1,3)) - sage: a.transport(p) + sage: p = PermutationGroupElement((1,3)) # optional - sage.groups + sage: a.transport(p) # optional - sage.groups {'a', 'c'} """ l = sorted([perm(i) for i in self._list]) @@ -94,12 +94,12 @@ def automorphism_group(self): sage: F = species.SubsetSpecies() sage: a = F.structures([1,2,3,4])[6]; a {1, 3} - sage: a.automorphism_group() + sage: a.automorphism_group() # optional - sage.groups Permutation Group with generators [(2,4), (1,3)] :: - sage: [a.transport(g) for g in a.automorphism_group()] + sage: [a.transport(g) for g in a.automorphism_group()] # optional - sage.groups [{1, 3}, {1, 3}, {1, 3}, {1, 3}] """ from sage.groups.perm_gps.permgroup_named import SymmetricGroup @@ -224,7 +224,7 @@ def _cis(self, series_ring, base_ring): EXAMPLES:: sage: S = species.SubsetSpecies() - sage: S.cycle_index_series()[0:5] + sage: S.cycle_index_series()[0:5] # optional - sage.modules [p[], 2*p[1], 2*p[1, 1] + p[2], diff --git a/src/sage/combinat/species/sum_species.py b/src/sage/combinat/species/sum_species.py index fe45a352943..ae877a64314 100644 --- a/src/sage/combinat/species/sum_species.py +++ b/src/sage/combinat/species/sum_species.py @@ -171,7 +171,7 @@ def _cis(self, series_ring, base_ring): sage: P = species.PermutationSpecies() sage: F = P + P - sage: F.cycle_index_series()[:5] + sage: F.cycle_index_series()[:5] # optional - sage.modules [2*p[], 2*p[1], 2*p[1, 1] + 2*p[2], @@ -214,7 +214,7 @@ def _equation(self, var_mapping): sage: X = species.SingletonSpecies() sage: S = X + X - sage: S.algebraic_equation_system() + sage: S.algebraic_equation_system() # optional - sage.graphs [node1 + (-2*z)] """ return sum(var_mapping[operand] for operand in self._state_info) From 6cb95c1d98c65fb692540ad7edba1955630b6871 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 10 Jun 2023 17:49:30 -0700 Subject: [PATCH 4/8] More # optional --- .../species/characteristic_species.py | 27 +++++----- .../combinat/species/composition_species.py | 52 +++++++++---------- src/sage/combinat/species/cycle_species.py | 14 ++--- src/sage/combinat/species/empty_species.py | 6 +-- .../species/functorial_composition_species.py | 8 +-- .../combinat/species/linear_order_species.py | 6 +-- .../combinat/species/partition_species.py | 2 +- src/sage/combinat/species/product_species.py | 4 +- src/sage/combinat/species/species.py | 4 +- src/sage/combinat/species/structure.py | 6 +-- src/sage/combinat/species/sum_species.py | 6 +-- 11 files changed, 67 insertions(+), 68 deletions(-) diff --git a/src/sage/combinat/species/characteristic_species.py b/src/sage/combinat/species/characteristic_species.py index e529dc97bd1..ca88dd7e91b 100644 --- a/src/sage/combinat/species/characteristic_species.py +++ b/src/sage/combinat/species/characteristic_species.py @@ -60,16 +60,15 @@ def canonical_label(self): def transport(self, perm): """ - Returns the transport of this structure along the permutation - perm. + Return the transport of this structure along the permutation ``perm``. EXAMPLES:: sage: F = species.CharacteristicSpecies(3) sage: a = F.structures(["a", "b", "c"]).random_element(); a {'a', 'b', 'c'} - sage: p = PermutationGroupElement((1,2)) - sage: a.transport(p) + sage: p = PermutationGroupElement((1,2)) # optional - sage.groups + sage: a.transport(p) # optional - sage.groups {'a', 'b', 'c'} """ return self @@ -85,7 +84,7 @@ def automorphism_group(self): sage: F = species.CharacteristicSpecies(3) sage: a = F.structures(["a", "b", "c"]).random_element(); a {'a', 'b', 'c'} - sage: a.automorphism_group() + sage: a.automorphism_group() # optional - sage.groups Symmetric group of order 3! as a permutation group """ from sage.groups.perm_gps.permgroup_named import SymmetricGroup @@ -111,7 +110,7 @@ def __init__(self, n, min=None, max=None, weight=None): [0, 1, 0, 0] sage: X.isotype_generating_series()[0:4] [0, 1, 0, 0] - sage: X.cycle_index_series()[0:4] + sage: X.cycle_index_series()[0:4] # optional - sage.modules [0, p[1], 0, 0] sage: F = species.CharacteristicSpecies(3) @@ -204,7 +203,7 @@ def _cis_term(self, base_ring): EXAMPLES:: sage: F = species.CharacteristicSpecies(2) - sage: g = F.cycle_index_series() + sage: g = F.cycle_index_series() # optional - sage.modules sage: g[0:5] [0, 0, 1/2*p[1, 1] + 1/2*p[2], 0, 0] """ @@ -220,11 +219,11 @@ def _equation(self, var_mapping): EXAMPLES:: sage: C = species.CharacteristicSpecies(2) - sage: Qz = QQ['z'] - sage: R. = Qz[] - sage: var_mapping = {'z':Qz.gen(), 'node0':R.gen()} - sage: C._equation(var_mapping) - z^2 + sage: Qz = QQ['z'] + sage: R. = Qz[] + sage: var_mapping = {'z':Qz.gen(), 'node0':R.gen()} + sage: C._equation(var_mapping) + z^2 """ return var_mapping['z']**(self._n) @@ -252,7 +251,7 @@ def __init__(self, min=None, max=None, weight=None): [1, 0, 0, 0] sage: X.isotype_generating_series()[0:4] [1, 0, 0, 0] - sage: X.cycle_index_series()[0:4] + sage: X.cycle_index_series()[0:4] # optional - sage.modules [p[], 0, 0, 0] TESTS:: @@ -296,7 +295,7 @@ def __init__(self, min=None, max=None, weight=None): [0, 1, 0, 0] sage: X.isotype_generating_series()[0:4] [0, 1, 0, 0] - sage: X.cycle_index_series()[0:4] + sage: X.cycle_index_series()[0:4] # optional - sage.modules [0, p[1], 0, 0] TESTS:: diff --git a/src/sage/combinat/species/composition_species.py b/src/sage/combinat/species/composition_species.py index c96f3161ba5..1937ead0811 100644 --- a/src/sage/combinat/species/composition_species.py +++ b/src/sage/combinat/species/composition_species.py @@ -28,8 +28,8 @@ def __init__(self, parent, labels, pi, f, gs): sage: E = species.SetSpecies(); C = species.CycleSpecies() sage: L = E(C) - sage: a = L.structures(['a','b','c']).random_element() - sage: a == loads(dumps(a)) + sage: a = L.structures(['a','b','c']).random_element() # optional - sage.libs.flint + sage: a == loads(dumps(a)) # optional - sage.libs.flint True """ self._partition = pi @@ -41,7 +41,7 @@ def __repr__(self): sage: E = species.SetSpecies(); C = species.CycleSpecies() sage: L = E(C) - sage: L.structures(['a','b','c'])[0] + sage: L.structures(['a','b','c'])[0] # optional - sage.libs.flint F-structure: {{'a', 'b', 'c'}}; G-structures: (('a', 'b', 'c'),) """ f, gs = self._list @@ -51,13 +51,13 @@ def transport(self, perm): """ EXAMPLES:: - sage: p = PermutationGroupElement((2,3)) + sage: p = PermutationGroupElement((2,3)) # optional - sage.groups sage: E = species.SetSpecies(); C = species.CycleSpecies() sage: L = E(C) - sage: S = L.structures(['a','b','c']).list() - sage: a = S[2]; a + sage: S = L.structures(['a','b','c']).list() # optional - sage.libs.flint + sage: a = S[2]; a # optional - sage.libs.flint F-structure: {{'a', 'c'}, {'b'}}; G-structures: (('a', 'c'), ('b')) - sage: a.transport(p) + sage: a.transport(p) # optional - sage.groups sage.libs.flint F-structure: {{'a', 'b'}, {'c'}}; G-structures: (('a', 'c'), ('b')) """ f, gs = self._list @@ -83,10 +83,10 @@ def change_labels(self, labels): sage: E = species.SetSpecies(); C = species.CycleSpecies() sage: L = E(C) - sage: S = L.structures(['a','b','c']).list() - sage: a = S[2]; a + sage: S = L.structures(['a','b','c']).list() # optional - sage.libs.flint + sage: a = S[2]; a # optional - sage.libs.flint F-structure: {{'a', 'c'}, {'b'}}; G-structures: (('a', 'c'), ('b')) - sage: a.change_labels([1,2,3]) + sage: a.change_labels([1,2,3]) # optional - sage.libs.flint F-structure: {{1, 3}, {2}}; G-structures: [(1, 3), (2)] """ f, gs = self._list @@ -116,7 +116,7 @@ def __init__(self, F, G, min=None, max=None, weight=None): sage: E = species.SetSpecies(); C = species.CycleSpecies() sage: L = E(C) sage: c = L.generating_series()[:3] - sage: L._check() #False due to isomorphism types not being implemented + sage: L._check() #False due to isomorphism types not being implemented # optional - sage.libs.flint False sage: L == loads(dumps(L)) True @@ -135,7 +135,7 @@ def _structures(self, structure_class, labels): sage: E = species.SetSpecies(); C = species.CycleSpecies() sage: L = E(C) - sage: L.structures(['a','b','c']).list() + sage: L.structures(['a','b','c']).list() # optional - sage.libs.flint [F-structure: {{'a', 'b', 'c'}}; G-structures: (('a', 'b', 'c'),), F-structure: {{'a', 'b', 'c'}}; G-structures: (('a', 'c', 'b'),), F-structure: {{'a', 'c'}, {'b'}}; G-structures: (('a', 'c'), ('b')), @@ -145,21 +145,21 @@ def _structures(self, structure_class, labels): TESTS:: - sage: a = _[2] - sage: f, gs = a._list - sage: f + sage: a = _[2] # optional - sage.libs.flint + sage: f, gs = a._list # optional - sage.libs.flint + sage: f # optional - sage.libs.flint {{'a', 'c'}, {'b'}} - sage: f.parent() + sage: f.parent() # optional - sage.libs.flint Set species - sage: f._list + sage: f._list # optional - sage.libs.flint [1, 2] - sage: f._labels + sage: f._labels # optional - sage.libs.flint [{'a', 'c'}, {'b'}] - sage: [g.parent() for g in gs] + sage: [g.parent() for g in gs] # optional - sage.libs.flint [Cyclic permutation species, Cyclic permutation species] - sage: [g._labels for g in gs] + sage: [g._labels for g in gs] # optional - sage.libs.flint [['a', 'c'], ['b']] - sage: [g._list for g in gs] + sage: [g._list for g in gs] # optional - sage.libs.flint [[1, 2], [1]] """ from itertools import product @@ -180,7 +180,7 @@ def _isotypes(self, structure_class, labels): sage: E = species.SetSpecies(); C = species.CycleSpecies() sage: L = E(C) - sage: L.isotypes(['a','b','c']).list() + sage: L.isotypes(['a','b','c']).list() # optional - sage.modules Traceback (most recent call last): ... NotImplementedError @@ -204,7 +204,7 @@ def _itgs(self, series_ring, base_ring): sage: E = species.SetSpecies(); C = species.CycleSpecies() sage: L = E(C) - sage: L.isotype_generating_series()[:10] + sage: L.isotype_generating_series()[:10] # optional - sage.modules [1, 1, 2, 3, 5, 7, 11, 15, 22, 30] """ cis = self.cycle_index_series(base_ring) @@ -216,7 +216,7 @@ def _cis(self, series_ring, base_ring): sage: E = species.SetSpecies(); C = species.CycleSpecies() sage: L = E(C) - sage: L.cycle_index_series()[:5] + sage: L.cycle_index_series()[:5] # optional - sage.modules [p[], p[1], p[1, 1] + p[2], @@ -233,7 +233,7 @@ def _cis(self, series_ring, base_ring): sage: E = species.SetSpecies() sage: C = species.CycleSpecies(weight=t) sage: S = E(C) - sage: S.isotype_generating_series()[:5] #indirect + sage: S.isotype_generating_series()[:5] #indirect # optional - sage.modules [1, t, t^2 + t, t^3 + t^2 + t, t^4 + t^3 + 2*t^2 + t] We do the same thing with set partitions weighted by the number of @@ -245,7 +245,7 @@ def _cis(self, series_ring, base_ring): sage: E = species.SetSpecies() sage: E_t = species.SetSpecies(min=1,weight=t) sage: Par = E(E_t) - sage: Par.isotype_generating_series()[:5] + sage: Par.isotype_generating_series()[:5] # optional - sage.modules [1, t, t^2 + t, t^3 + t^2 + t, t^4 + t^3 + 2*t^2 + t] """ f_cis = self._F.cycle_index_series(base_ring) diff --git a/src/sage/combinat/species/cycle_species.py b/src/sage/combinat/species/cycle_species.py index ed442e75ba9..e1faab86c91 100644 --- a/src/sage/combinat/species/cycle_species.py +++ b/src/sage/combinat/species/cycle_species.py @@ -51,7 +51,7 @@ def permutation_group_element(self): sage: F = species.CycleSpecies() sage: a = F.structures(["a", "b", "c"])[0]; a ('a', 'b', 'c') - sage: a.permutation_group_element() + sage: a.permutation_group_element() # optional - sage.groups (1,2,3) """ from sage.groups.perm_gps.constructor import PermutationGroupElement @@ -67,8 +67,8 @@ def transport(self, perm): sage: F = species.CycleSpecies() sage: a = F.structures(["a", "b", "c"])[0]; a ('a', 'b', 'c') - sage: p = PermutationGroupElement((1,2)) - sage: a.transport(p) + sage: p = PermutationGroupElement((1,2)) # optional - sage.groups + sage: a.transport(p) # optional - sage.groups ('a', 'c', 'b') """ p = self.permutation_group_element() @@ -88,12 +88,12 @@ def automorphism_group(self): sage: P = species.CycleSpecies() sage: a = P.structures([1, 2, 3, 4])[0]; a (1, 2, 3, 4) - sage: a.automorphism_group() + sage: a.automorphism_group() # optional - sage.groups Permutation Group with generators [(1,2,3,4)] :: - sage: [a.transport(perm) for perm in a.automorphism_group()] + sage: [a.transport(perm) for perm in a.automorphism_group()] # optional - sage.groups [(1, 2, 3, 4), (1, 2, 3, 4), (1, 2, 3, 4), (1, 2, 3, 4)] """ from sage.groups.perm_gps.permgroup_named import SymmetricGroup @@ -255,8 +255,8 @@ def _cis_callable(self, base_ring, n): EXAMPLES:: sage: P = species.CycleSpecies() - sage: cis = P.cycle_index_series() - sage: cis[0:7] + sage: cis = P.cycle_index_series() # optional - sage.modules + sage: cis[0:7] # optional - sage.modules [0, p[1], 1/2*p[1, 1] + 1/2*p[2], diff --git a/src/sage/combinat/species/empty_species.py b/src/sage/combinat/species/empty_species.py index e66019360ac..d3ddcad0cf3 100644 --- a/src/sage/combinat/species/empty_species.py +++ b/src/sage/combinat/species/empty_species.py @@ -38,7 +38,7 @@ class EmptySpecies(GenericCombinatorialSpecies, UniqueRepresentation): [0, 0, 0, 0] sage: X.isotype_generating_series()[0:4] [0, 0, 0, 0] - sage: X.cycle_index_series()[0:4] + sage: X.cycle_index_series()[0:4] # optional - sage.modules [0, 0, 0, 0] The empty species is the zero of the semi-ring of species. @@ -55,7 +55,7 @@ class EmptySpecies(GenericCombinatorialSpecies, UniqueRepresentation): sage: (X.isotype_generating_series()[0:4] == ....: S.isotype_generating_series()[0:4]) True - sage: (X.cycle_index_series()[0:4] == + sage: (X.cycle_index_series()[0:4] == # optional - sage.modules ....: S.cycle_index_series()[0:4]) True @@ -69,7 +69,7 @@ class EmptySpecies(GenericCombinatorialSpecies, UniqueRepresentation): [0, 0, 0, 0] sage: Y.isotype_generating_series()[0:4] [0, 0, 0, 0] - sage: Y.cycle_index_series()[0:4] + sage: Y.cycle_index_series()[0:4] # optional - sage.modules [0, 0, 0, 0] TESTS:: diff --git a/src/sage/combinat/species/functorial_composition_species.py b/src/sage/combinat/species/functorial_composition_species.py index 118e924d426..99da72c1d9c 100644 --- a/src/sage/combinat/species/functorial_composition_species.py +++ b/src/sage/combinat/species/functorial_composition_species.py @@ -35,7 +35,7 @@ def __init__(self, F, G, min=None, max=None, weight=None): sage: WP = species.SubsetSpecies() sage: P2 = E2*E sage: G = WP.functorial_composition(P2) - sage: G.isotype_generating_series()[0:5] + sage: G.isotype_generating_series()[0:5] # optional - sage.modules [1, 1, 2, 4, 11] sage: G = species.SimpleGraphSpecies() @@ -81,7 +81,7 @@ def _isotypes(self, structure_class, s): EXAMPLES:: sage: G = species.SimpleGraphSpecies() - sage: G.isotypes([1,2,3]).list() + sage: G.isotypes([1,2,3]).list() # optional - sage.modules Traceback (most recent call last): ... NotImplementedError @@ -103,7 +103,7 @@ def _itgs(self, series_ring, base_ring): EXAMPLES:: sage: G = species.SimpleGraphSpecies() - sage: G.isotype_generating_series()[0:5] + sage: G.isotype_generating_series()[0:5] # optional - sage.modules [1, 1, 2, 4, 11] """ return self.cycle_index_series(base_ring).isotype_generating_series() @@ -113,7 +113,7 @@ def _cis(self, series_ring, base_ring): EXAMPLES:: sage: G = species.SimpleGraphSpecies() - sage: G.cycle_index_series()[0:5] + sage: G.cycle_index_series()[0:5] # optional - sage.modules [p[], p[1], p[1, 1] + p[2], diff --git a/src/sage/combinat/species/linear_order_species.py b/src/sage/combinat/species/linear_order_species.py index 6203442ec8f..6b64178bdbc 100644 --- a/src/sage/combinat/species/linear_order_species.py +++ b/src/sage/combinat/species/linear_order_species.py @@ -43,7 +43,7 @@ def transport(self, perm): sage: F = species.LinearOrderSpecies() sage: a = F.structures(["a", "b", "c"])[0]; a ['a', 'b', 'c'] - sage: p = PermutationGroupElement((1,2)) + sage: p = PermutationGroupElement((1,2)) # optional - sage.groups sage: a.transport(p) ['b', 'a', 'c'] """ @@ -60,7 +60,7 @@ def automorphism_group(self): sage: F = species.LinearOrderSpecies() sage: a = F.structures(["a", "b", "c"])[0]; a ['a', 'b', 'c'] - sage: a.automorphism_group() + sage: a.automorphism_group() # optional - sage.groups Symmetric group of order 1! as a permutation group """ from sage.groups.perm_gps.permgroup_named import SymmetricGroup @@ -155,7 +155,7 @@ def _cis_callable(self, base_ring, n): EXAMPLES:: sage: L = species.LinearOrderSpecies() - sage: g = L.cycle_index_series() + sage: g = L.cycle_index_series() # optional - sage.modules sage: g[0:5] [p[], p[1], p[1, 1], p[1, 1, 1], p[1, 1, 1, 1]] """ diff --git a/src/sage/combinat/species/partition_species.py b/src/sage/combinat/species/partition_species.py index f9044db7c73..f3038ad6ba2 100644 --- a/src/sage/combinat/species/partition_species.py +++ b/src/sage/combinat/species/partition_species.py @@ -272,7 +272,7 @@ def _cis(self, series_ring, base_ring): EXAMPLES:: sage: P = species.PartitionSpecies() - sage: g = P.cycle_index_series() + sage: g = P.cycle_index_series() # optional - sage.modules sage: g[0:5] [p[], p[1], diff --git a/src/sage/combinat/species/product_species.py b/src/sage/combinat/species/product_species.py index a3bcb3f4bb4..b1ce34596fd 100644 --- a/src/sage/combinat/species/product_species.py +++ b/src/sage/combinat/species/product_species.py @@ -215,7 +215,7 @@ def __init__(self, F, G, min=None, max=None, weight=None): Product of (Permutation species) and (Permutation species) sage: F == loads(dumps(F)) True - sage: F._check() + sage: F._check() # optional - sage.libs.flint True TESTS:: @@ -340,7 +340,7 @@ def _itgs(self, series_ring, base_ring): sage: P = species.PermutationSpecies() sage: F = P * P - sage: F.isotype_generating_series()[0:5] + sage: F.isotype_generating_series()[0:5] # optional - sage.libs.flint [1, 2, 5, 10, 20] """ res = (self.left_factor().isotype_generating_series(base_ring) * diff --git a/src/sage/combinat/species/species.py b/src/sage/combinat/species/species.py index 9c3365f81b7..871a62009af 100644 --- a/src/sage/combinat/species/species.py +++ b/src/sage/combinat/species/species.py @@ -401,7 +401,7 @@ def _check(self, n=5): EXAMPLES:: sage: P = species.PartitionSpecies() - sage: P._check() + sage: P._check() # optional - sage.libs.flint True """ st = self.structures(range(n)) @@ -622,7 +622,7 @@ def isotype_generating_series(self, base_ring=None): sage: P = species.PermutationSpecies() sage: g = P.isotype_generating_series() - sage: g[0:4] + sage: g[0:4] # optional - sage.libs.flint [1, 1, 2, 3] sage: g.counts(4) [1, 1, 2, 3] diff --git a/src/sage/combinat/species/structure.py b/src/sage/combinat/species/structure.py index a4de6349c6d..d0ca053d632 100644 --- a/src/sage/combinat/species/structure.py +++ b/src/sage/combinat/species/structure.py @@ -277,9 +277,9 @@ def transport(self, perm): EXAMPLES:: sage: P = species.PartitionSpecies() - sage: s = (P+P).structures([1,2,3])[1]; s + sage: s = (P+P).structures([1,2,3])[1]; s # optional - sage.libs.flint {{1, 3}, {2}} - sage: s.transport(PermutationGroupElement((2,3))) + sage: s.transport(PermutationGroupElement((2,3))) # optional - sage.groups sage.libs.flint {{1, 2}, {3}} """ return self.__class__(self._parent, self._s.transport(perm), **self._options) @@ -289,7 +289,7 @@ def canonical_label(self): EXAMPLES:: sage: P = species.PartitionSpecies() - sage: s = (P+P).structures([1,2,3])[1]; s + sage: s = (P+P).structures([1,2,3])[1]; s # optional - sage.libs.flint {{1, 3}, {2}} sage: s.canonical_label() {{1, 2}, {3}} diff --git a/src/sage/combinat/species/sum_species.py b/src/sage/combinat/species/sum_species.py index ae877a64314..ac2e05943b3 100644 --- a/src/sage/combinat/species/sum_species.py +++ b/src/sage/combinat/species/sum_species.py @@ -38,7 +38,7 @@ def __init__(self, F, G, min=None, max=None, weight=None): sage: P = species.PermutationSpecies() sage: F = P + P - sage: F._check() + sage: F._check() # optional - sage.libs.flint True sage: F == loads(dumps(F)) True @@ -126,7 +126,7 @@ def _isotypes(self, structure_class, labels): sage: P = species.PermutationSpecies() sage: F = P + P - sage: F.isotypes([1,2]).list() + sage: F.isotypes([1,2]).list() # optional - sage.libs.flint [[2, 1], [1, 2], [2, 1], [1, 2]] """ for res in self._F.isotypes(labels): @@ -157,7 +157,7 @@ def _itgs(self, series_ring, base_ring): sage: P = species.PermutationSpecies() sage: F = P + P - sage: F.isotype_generating_series()[:5] + sage: F.isotype_generating_series()[:5] # optional - sage.libs.flint [2, 2, 4, 6, 10] """ return (self.left_summand().isotype_generating_series(base_ring) + From 7f205583588bc67af46c37e3ced399083af786c2 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 11 Jun 2023 23:46:00 -0700 Subject: [PATCH 5/8] sage.combinat: More # optional --- src/sage/combinat/species/characteristic_species.py | 2 +- src/sage/combinat/species/functorial_composition_species.py | 2 +- src/sage/combinat/species/linear_order_species.py | 4 ++-- src/sage/combinat/species/species.py | 6 +++--- src/sage/combinat/species/structure.py | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/sage/combinat/species/characteristic_species.py b/src/sage/combinat/species/characteristic_species.py index ca88dd7e91b..c3e55239335 100644 --- a/src/sage/combinat/species/characteristic_species.py +++ b/src/sage/combinat/species/characteristic_species.py @@ -204,7 +204,7 @@ def _cis_term(self, base_ring): sage: F = species.CharacteristicSpecies(2) sage: g = F.cycle_index_series() # optional - sage.modules - sage: g[0:5] + sage: g[0:5] # optional - sage.modules [0, 0, 1/2*p[1, 1] + 1/2*p[2], 0, 0] """ cis = SetSpecies(weight=self._weight).cycle_index_series(base_ring) diff --git a/src/sage/combinat/species/functorial_composition_species.py b/src/sage/combinat/species/functorial_composition_species.py index 99da72c1d9c..68a07967671 100644 --- a/src/sage/combinat/species/functorial_composition_species.py +++ b/src/sage/combinat/species/functorial_composition_species.py @@ -44,7 +44,7 @@ def __init__(self, F, G, min=None, max=None, weight=None): sage: G == loads(dumps(G)) True - sage: G._check() #False due to isomorphism types not being implemented + sage: G._check() # False due to isomorphism types not being implemented # optional - sage.modules False """ self._F = F diff --git a/src/sage/combinat/species/linear_order_species.py b/src/sage/combinat/species/linear_order_species.py index 6b64178bdbc..a889c8ab6c2 100644 --- a/src/sage/combinat/species/linear_order_species.py +++ b/src/sage/combinat/species/linear_order_species.py @@ -44,7 +44,7 @@ def transport(self, perm): sage: a = F.structures(["a", "b", "c"])[0]; a ['a', 'b', 'c'] sage: p = PermutationGroupElement((1,2)) # optional - sage.groups - sage: a.transport(p) + sage: a.transport(p) # optional - sage.groups ['b', 'a', 'c'] """ return LinearOrderSpeciesStructure(self.parent(), self._labels, [perm(i) for i in self._list]) @@ -156,7 +156,7 @@ def _cis_callable(self, base_ring, n): sage: L = species.LinearOrderSpecies() sage: g = L.cycle_index_series() # optional - sage.modules - sage: g[0:5] + sage: g[0:5] # optional - sage.modules [p[], p[1], p[1, 1], p[1, 1, 1], p[1, 1, 1, 1]] """ from sage.combinat.sf.sf import SymmetricFunctions diff --git a/src/sage/combinat/species/species.py b/src/sage/combinat/species/species.py index 871a62009af..0efdb963981 100644 --- a/src/sage/combinat/species/species.py +++ b/src/sage/combinat/species/species.py @@ -624,11 +624,11 @@ def isotype_generating_series(self, base_ring=None): sage: g = P.isotype_generating_series() sage: g[0:4] # optional - sage.libs.flint [1, 1, 2, 3] - sage: g.counts(4) + sage: g.counts(4) # optional - sage.libs.flint [1, 1, 2, 3] - sage: P.isotypes([1,2,3]).list() + sage: P.isotypes([1,2,3]).list() # optional - sage.libs.flint [[2, 3, 1], [2, 1, 3], [1, 2, 3]] - sage: len(_) + sage: len(_) # optional - sage.libs.flint 3 """ return self._get_series(OrdinaryGeneratingSeriesRing, "itgs", base_ring) diff --git a/src/sage/combinat/species/structure.py b/src/sage/combinat/species/structure.py index d0ca053d632..6dc1fc2ea15 100644 --- a/src/sage/combinat/species/structure.py +++ b/src/sage/combinat/species/structure.py @@ -291,7 +291,7 @@ def canonical_label(self): sage: P = species.PartitionSpecies() sage: s = (P+P).structures([1,2,3])[1]; s # optional - sage.libs.flint {{1, 3}, {2}} - sage: s.canonical_label() + sage: s.canonical_label() # optional - sage.libs.flint {{1, 2}, {3}} """ return self.__class__(self._parent, self._s.canonical_label(), **self._options) From 7cdec9bc1bfcbd13c8594a5a1615575d1a0b8fd2 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 12 Jul 2023 17:59:24 -0700 Subject: [PATCH 6/8] ./sage -fixdoctests --distribution sagemath-categories --only-tags src/sage/combinat --- .../species/characteristic_species.py | 16 +-- .../combinat/species/composition_species.py | 52 ++++---- src/sage/combinat/species/cycle_species.py | 14 +-- src/sage/combinat/species/empty_species.py | 6 +- .../species/functorial_composition_species.py | 10 +- .../combinat/species/generating_series.py | 116 +++++++++--------- src/sage/combinat/species/library.py | 22 ++-- .../combinat/species/linear_order_species.py | 10 +- .../combinat/species/partition_species.py | 2 +- .../combinat/species/permutation_species.py | 6 +- src/sage/combinat/species/product_species.py | 34 ++--- .../combinat/species/recursive_species.py | 12 +- src/sage/combinat/species/set_species.py | 10 +- src/sage/combinat/species/species.py | 48 ++++---- src/sage/combinat/species/structure.py | 12 +- src/sage/combinat/species/subset_species.py | 14 +-- src/sage/combinat/species/sum_species.py | 10 +- 17 files changed, 197 insertions(+), 197 deletions(-) diff --git a/src/sage/combinat/species/characteristic_species.py b/src/sage/combinat/species/characteristic_species.py index c3e55239335..37ce75abe28 100644 --- a/src/sage/combinat/species/characteristic_species.py +++ b/src/sage/combinat/species/characteristic_species.py @@ -67,8 +67,8 @@ def transport(self, perm): sage: F = species.CharacteristicSpecies(3) sage: a = F.structures(["a", "b", "c"]).random_element(); a {'a', 'b', 'c'} - sage: p = PermutationGroupElement((1,2)) # optional - sage.groups - sage: a.transport(p) # optional - sage.groups + sage: p = PermutationGroupElement((1,2)) # needs sage.groups + sage: a.transport(p) # needs sage.groups {'a', 'b', 'c'} """ return self @@ -84,7 +84,7 @@ def automorphism_group(self): sage: F = species.CharacteristicSpecies(3) sage: a = F.structures(["a", "b", "c"]).random_element(); a {'a', 'b', 'c'} - sage: a.automorphism_group() # optional - sage.groups + sage: a.automorphism_group() # needs sage.groups Symmetric group of order 3! as a permutation group """ from sage.groups.perm_gps.permgroup_named import SymmetricGroup @@ -110,7 +110,7 @@ def __init__(self, n, min=None, max=None, weight=None): [0, 1, 0, 0] sage: X.isotype_generating_series()[0:4] [0, 1, 0, 0] - sage: X.cycle_index_series()[0:4] # optional - sage.modules + sage: X.cycle_index_series()[0:4] # needs sage.modules [0, p[1], 0, 0] sage: F = species.CharacteristicSpecies(3) @@ -203,8 +203,8 @@ def _cis_term(self, base_ring): EXAMPLES:: sage: F = species.CharacteristicSpecies(2) - sage: g = F.cycle_index_series() # optional - sage.modules - sage: g[0:5] # optional - sage.modules + sage: g = F.cycle_index_series() # needs sage.modules + sage: g[0:5] # needs sage.modules [0, 0, 1/2*p[1, 1] + 1/2*p[2], 0, 0] """ cis = SetSpecies(weight=self._weight).cycle_index_series(base_ring) @@ -251,7 +251,7 @@ def __init__(self, min=None, max=None, weight=None): [1, 0, 0, 0] sage: X.isotype_generating_series()[0:4] [1, 0, 0, 0] - sage: X.cycle_index_series()[0:4] # optional - sage.modules + sage: X.cycle_index_series()[0:4] # needs sage.modules [p[], 0, 0, 0] TESTS:: @@ -295,7 +295,7 @@ def __init__(self, min=None, max=None, weight=None): [0, 1, 0, 0] sage: X.isotype_generating_series()[0:4] [0, 1, 0, 0] - sage: X.cycle_index_series()[0:4] # optional - sage.modules + sage: X.cycle_index_series()[0:4] # needs sage.modules [0, p[1], 0, 0] TESTS:: diff --git a/src/sage/combinat/species/composition_species.py b/src/sage/combinat/species/composition_species.py index 1937ead0811..a60b0cbed89 100644 --- a/src/sage/combinat/species/composition_species.py +++ b/src/sage/combinat/species/composition_species.py @@ -28,8 +28,8 @@ def __init__(self, parent, labels, pi, f, gs): sage: E = species.SetSpecies(); C = species.CycleSpecies() sage: L = E(C) - sage: a = L.structures(['a','b','c']).random_element() # optional - sage.libs.flint - sage: a == loads(dumps(a)) # optional - sage.libs.flint + sage: a = L.structures(['a','b','c']).random_element() # needs sage.libs.flint + sage: a == loads(dumps(a)) # needs sage.libs.flint True """ self._partition = pi @@ -41,7 +41,7 @@ def __repr__(self): sage: E = species.SetSpecies(); C = species.CycleSpecies() sage: L = E(C) - sage: L.structures(['a','b','c'])[0] # optional - sage.libs.flint + sage: L.structures(['a','b','c'])[0] # needs sage.libs.flint F-structure: {{'a', 'b', 'c'}}; G-structures: (('a', 'b', 'c'),) """ f, gs = self._list @@ -51,13 +51,13 @@ def transport(self, perm): """ EXAMPLES:: - sage: p = PermutationGroupElement((2,3)) # optional - sage.groups + sage: p = PermutationGroupElement((2,3)) # needs sage.groups sage: E = species.SetSpecies(); C = species.CycleSpecies() sage: L = E(C) - sage: S = L.structures(['a','b','c']).list() # optional - sage.libs.flint - sage: a = S[2]; a # optional - sage.libs.flint + sage: S = L.structures(['a','b','c']).list() # needs sage.libs.flint + sage: a = S[2]; a # needs sage.libs.flint F-structure: {{'a', 'c'}, {'b'}}; G-structures: (('a', 'c'), ('b')) - sage: a.transport(p) # optional - sage.groups sage.libs.flint + sage: a.transport(p) # needs sage.groups sage.libs.flint F-structure: {{'a', 'b'}, {'c'}}; G-structures: (('a', 'c'), ('b')) """ f, gs = self._list @@ -83,10 +83,10 @@ def change_labels(self, labels): sage: E = species.SetSpecies(); C = species.CycleSpecies() sage: L = E(C) - sage: S = L.structures(['a','b','c']).list() # optional - sage.libs.flint - sage: a = S[2]; a # optional - sage.libs.flint + sage: S = L.structures(['a','b','c']).list() # needs sage.libs.flint + sage: a = S[2]; a # needs sage.libs.flint F-structure: {{'a', 'c'}, {'b'}}; G-structures: (('a', 'c'), ('b')) - sage: a.change_labels([1,2,3]) # optional - sage.libs.flint + sage: a.change_labels([1,2,3]) # needs sage.libs.flint F-structure: {{1, 3}, {2}}; G-structures: [(1, 3), (2)] """ f, gs = self._list @@ -116,7 +116,7 @@ def __init__(self, F, G, min=None, max=None, weight=None): sage: E = species.SetSpecies(); C = species.CycleSpecies() sage: L = E(C) sage: c = L.generating_series()[:3] - sage: L._check() #False due to isomorphism types not being implemented # optional - sage.libs.flint + sage: L._check() #False due to isomorphism types not being implemented # needs sage.libs.flint False sage: L == loads(dumps(L)) True @@ -135,7 +135,7 @@ def _structures(self, structure_class, labels): sage: E = species.SetSpecies(); C = species.CycleSpecies() sage: L = E(C) - sage: L.structures(['a','b','c']).list() # optional - sage.libs.flint + sage: L.structures(['a','b','c']).list() # needs sage.libs.flint [F-structure: {{'a', 'b', 'c'}}; G-structures: (('a', 'b', 'c'),), F-structure: {{'a', 'b', 'c'}}; G-structures: (('a', 'c', 'b'),), F-structure: {{'a', 'c'}, {'b'}}; G-structures: (('a', 'c'), ('b')), @@ -145,21 +145,21 @@ def _structures(self, structure_class, labels): TESTS:: - sage: a = _[2] # optional - sage.libs.flint - sage: f, gs = a._list # optional - sage.libs.flint - sage: f # optional - sage.libs.flint + sage: a = _[2] # needs sage.libs.flint + sage: f, gs = a._list # needs sage.libs.flint + sage: f # needs sage.libs.flint {{'a', 'c'}, {'b'}} - sage: f.parent() # optional - sage.libs.flint + sage: f.parent() # needs sage.libs.flint Set species - sage: f._list # optional - sage.libs.flint + sage: f._list # needs sage.libs.flint [1, 2] - sage: f._labels # optional - sage.libs.flint + sage: f._labels # needs sage.libs.flint [{'a', 'c'}, {'b'}] - sage: [g.parent() for g in gs] # optional - sage.libs.flint + sage: [g.parent() for g in gs] # needs sage.libs.flint [Cyclic permutation species, Cyclic permutation species] - sage: [g._labels for g in gs] # optional - sage.libs.flint + sage: [g._labels for g in gs] # needs sage.libs.flint [['a', 'c'], ['b']] - sage: [g._list for g in gs] # optional - sage.libs.flint + sage: [g._list for g in gs] # needs sage.libs.flint [[1, 2], [1]] """ from itertools import product @@ -180,7 +180,7 @@ def _isotypes(self, structure_class, labels): sage: E = species.SetSpecies(); C = species.CycleSpecies() sage: L = E(C) - sage: L.isotypes(['a','b','c']).list() # optional - sage.modules + sage: L.isotypes(['a','b','c']).list() # needs sage.modules Traceback (most recent call last): ... NotImplementedError @@ -204,7 +204,7 @@ def _itgs(self, series_ring, base_ring): sage: E = species.SetSpecies(); C = species.CycleSpecies() sage: L = E(C) - sage: L.isotype_generating_series()[:10] # optional - sage.modules + sage: L.isotype_generating_series()[:10] # needs sage.modules [1, 1, 2, 3, 5, 7, 11, 15, 22, 30] """ cis = self.cycle_index_series(base_ring) @@ -216,7 +216,7 @@ def _cis(self, series_ring, base_ring): sage: E = species.SetSpecies(); C = species.CycleSpecies() sage: L = E(C) - sage: L.cycle_index_series()[:5] # optional - sage.modules + sage: L.cycle_index_series()[:5] # needs sage.modules [p[], p[1], p[1, 1] + p[2], @@ -233,7 +233,7 @@ def _cis(self, series_ring, base_ring): sage: E = species.SetSpecies() sage: C = species.CycleSpecies(weight=t) sage: S = E(C) - sage: S.isotype_generating_series()[:5] #indirect # optional - sage.modules + sage: S.isotype_generating_series()[:5] #indirect # needs sage.modules [1, t, t^2 + t, t^3 + t^2 + t, t^4 + t^3 + 2*t^2 + t] We do the same thing with set partitions weighted by the number of @@ -245,7 +245,7 @@ def _cis(self, series_ring, base_ring): sage: E = species.SetSpecies() sage: E_t = species.SetSpecies(min=1,weight=t) sage: Par = E(E_t) - sage: Par.isotype_generating_series()[:5] # optional - sage.modules + sage: Par.isotype_generating_series()[:5] # needs sage.modules [1, t, t^2 + t, t^3 + t^2 + t, t^4 + t^3 + 2*t^2 + t] """ f_cis = self._F.cycle_index_series(base_ring) diff --git a/src/sage/combinat/species/cycle_species.py b/src/sage/combinat/species/cycle_species.py index e1faab86c91..c808f6a0db1 100644 --- a/src/sage/combinat/species/cycle_species.py +++ b/src/sage/combinat/species/cycle_species.py @@ -51,7 +51,7 @@ def permutation_group_element(self): sage: F = species.CycleSpecies() sage: a = F.structures(["a", "b", "c"])[0]; a ('a', 'b', 'c') - sage: a.permutation_group_element() # optional - sage.groups + sage: a.permutation_group_element() # needs sage.groups (1,2,3) """ from sage.groups.perm_gps.constructor import PermutationGroupElement @@ -67,8 +67,8 @@ def transport(self, perm): sage: F = species.CycleSpecies() sage: a = F.structures(["a", "b", "c"])[0]; a ('a', 'b', 'c') - sage: p = PermutationGroupElement((1,2)) # optional - sage.groups - sage: a.transport(p) # optional - sage.groups + sage: p = PermutationGroupElement((1,2)) # needs sage.groups + sage: a.transport(p) # needs sage.groups ('a', 'c', 'b') """ p = self.permutation_group_element() @@ -88,12 +88,12 @@ def automorphism_group(self): sage: P = species.CycleSpecies() sage: a = P.structures([1, 2, 3, 4])[0]; a (1, 2, 3, 4) - sage: a.automorphism_group() # optional - sage.groups + sage: a.automorphism_group() # needs sage.groups Permutation Group with generators [(1,2,3,4)] :: - sage: [a.transport(perm) for perm in a.automorphism_group()] # optional - sage.groups + sage: [a.transport(perm) for perm in a.automorphism_group()] # needs sage.groups [(1, 2, 3, 4), (1, 2, 3, 4), (1, 2, 3, 4), (1, 2, 3, 4)] """ from sage.groups.perm_gps.permgroup_named import SymmetricGroup @@ -255,8 +255,8 @@ def _cis_callable(self, base_ring, n): EXAMPLES:: sage: P = species.CycleSpecies() - sage: cis = P.cycle_index_series() # optional - sage.modules - sage: cis[0:7] # optional - sage.modules + sage: cis = P.cycle_index_series() # needs sage.modules + sage: cis[0:7] # needs sage.modules [0, p[1], 1/2*p[1, 1] + 1/2*p[2], diff --git a/src/sage/combinat/species/empty_species.py b/src/sage/combinat/species/empty_species.py index d3ddcad0cf3..5c4762cb34d 100644 --- a/src/sage/combinat/species/empty_species.py +++ b/src/sage/combinat/species/empty_species.py @@ -38,7 +38,7 @@ class EmptySpecies(GenericCombinatorialSpecies, UniqueRepresentation): [0, 0, 0, 0] sage: X.isotype_generating_series()[0:4] [0, 0, 0, 0] - sage: X.cycle_index_series()[0:4] # optional - sage.modules + sage: X.cycle_index_series()[0:4] # needs sage.modules [0, 0, 0, 0] The empty species is the zero of the semi-ring of species. @@ -55,7 +55,7 @@ class EmptySpecies(GenericCombinatorialSpecies, UniqueRepresentation): sage: (X.isotype_generating_series()[0:4] == ....: S.isotype_generating_series()[0:4]) True - sage: (X.cycle_index_series()[0:4] == # optional - sage.modules + sage: (X.cycle_index_series()[0:4] == # needs sage.modules ....: S.cycle_index_series()[0:4]) True @@ -69,7 +69,7 @@ class EmptySpecies(GenericCombinatorialSpecies, UniqueRepresentation): [0, 0, 0, 0] sage: Y.isotype_generating_series()[0:4] [0, 0, 0, 0] - sage: Y.cycle_index_series()[0:4] # optional - sage.modules + sage: Y.cycle_index_series()[0:4] # needs sage.modules [0, 0, 0, 0] TESTS:: diff --git a/src/sage/combinat/species/functorial_composition_species.py b/src/sage/combinat/species/functorial_composition_species.py index 68a07967671..b327492a54a 100644 --- a/src/sage/combinat/species/functorial_composition_species.py +++ b/src/sage/combinat/species/functorial_composition_species.py @@ -35,7 +35,7 @@ def __init__(self, F, G, min=None, max=None, weight=None): sage: WP = species.SubsetSpecies() sage: P2 = E2*E sage: G = WP.functorial_composition(P2) - sage: G.isotype_generating_series()[0:5] # optional - sage.modules + sage: G.isotype_generating_series()[0:5] # needs sage.modules [1, 1, 2, 4, 11] sage: G = species.SimpleGraphSpecies() @@ -44,7 +44,7 @@ def __init__(self, F, G, min=None, max=None, weight=None): sage: G == loads(dumps(G)) True - sage: G._check() # False due to isomorphism types not being implemented # optional - sage.modules + sage: G._check() # False due to isomorphism types not being implemented # needs sage.modules False """ self._F = F @@ -81,7 +81,7 @@ def _isotypes(self, structure_class, s): EXAMPLES:: sage: G = species.SimpleGraphSpecies() - sage: G.isotypes([1,2,3]).list() # optional - sage.modules + sage: G.isotypes([1,2,3]).list() # needs sage.modules Traceback (most recent call last): ... NotImplementedError @@ -103,7 +103,7 @@ def _itgs(self, series_ring, base_ring): EXAMPLES:: sage: G = species.SimpleGraphSpecies() - sage: G.isotype_generating_series()[0:5] # optional - sage.modules + sage: G.isotype_generating_series()[0:5] # needs sage.modules [1, 1, 2, 4, 11] """ return self.cycle_index_series(base_ring).isotype_generating_series() @@ -113,7 +113,7 @@ def _cis(self, series_ring, base_ring): EXAMPLES:: sage: G = species.SimpleGraphSpecies() - sage: G.cycle_index_series()[0:5] # optional - sage.modules + sage: G.cycle_index_series()[0:5] # needs sage.modules [p[], p[1], p[1, 1] + p[2], diff --git a/src/sage/combinat/species/generating_series.py b/src/sage/combinat/species/generating_series.py index 24830b17bcd..9c0515bbead 100644 --- a/src/sage/combinat/species/generating_series.py +++ b/src/sage/combinat/species/generating_series.py @@ -16,18 +16,18 @@ TESTS:: sage: from sage.combinat.species.generating_series import CycleIndexSeriesRing - sage: p = SymmetricFunctions(QQ).power() # optional - sage.modules - sage: CIS = CycleIndexSeriesRing(QQ) # optional - sage.modules - sage: geo1 = CIS(lambda i: p([1])^i) # optional - sage.modules - sage: geo2 = CIS(lambda i: p([2])^(i // 2) if is_even(i) else 0) # optional - sage.modules - sage: s = geo1 * geo2 # optional - sage.modules - sage: s[0] # optional - sage.modules + sage: p = SymmetricFunctions(QQ).power() # needs sage.modules + sage: CIS = CycleIndexSeriesRing(QQ) # needs sage.modules + sage: geo1 = CIS(lambda i: p([1])^i) # needs sage.modules + sage: geo2 = CIS(lambda i: p([2])^(i // 2) if is_even(i) else 0) # needs sage.modules + sage: s = geo1 * geo2 # needs sage.modules + sage: s[0] # needs sage.modules p[] - sage: s[1] # optional - sage.modules + sage: s[1] # needs sage.modules p[1] - sage: s[2] # optional - sage.modules + sage: s[2] # needs sage.modules p[1, 1] + p[2] - sage: s[3] # optional - sage.modules + sage: s[3] # needs sage.modules p[1, 1, 1] + p[2, 1] REFERENCES: @@ -293,14 +293,14 @@ def count(self, t): EXAMPLES:: sage: from sage.combinat.species.generating_series import CycleIndexSeriesRing - sage: p = SymmetricFunctions(QQ).power() # optional - sage.modules - sage: CIS = CycleIndexSeriesRing(QQ) # optional - sage.modules - sage: f = CIS([0, p([1]), 2*p([1,1]), 3*p([2,1])]) # optional - sage.modules - sage: f.count([1]) # optional - sage.modules + sage: p = SymmetricFunctions(QQ).power() # needs sage.modules + sage: CIS = CycleIndexSeriesRing(QQ) # needs sage.modules + sage: f = CIS([0, p([1]), 2*p([1,1]), 3*p([2,1])]) # needs sage.modules + sage: f.count([1]) # needs sage.modules 1 - sage: f.count([1,1]) # optional - sage.modules + sage: f.count([1,1]) # needs sage.modules 4 - sage: f.count([2,1]) # optional - sage.modules + sage: f.count([2,1]) # needs sage.modules 6 """ t = Partition(t) @@ -313,14 +313,14 @@ def coefficient_cycle_type(self, t): EXAMPLES:: sage: from sage.combinat.species.generating_series import CycleIndexSeriesRing - sage: p = SymmetricFunctions(QQ).power() # optional - sage.modules - sage: CIS = CycleIndexSeriesRing(QQ) # optional - sage.modules - sage: f = CIS([0, p([1]), 2*p([1,1]),3*p([2,1])]) # optional - sage.modules - sage: f.coefficient_cycle_type([1]) # optional - sage.modules + sage: p = SymmetricFunctions(QQ).power() # needs sage.modules + sage: CIS = CycleIndexSeriesRing(QQ) # needs sage.modules + sage: f = CIS([0, p([1]), 2*p([1,1]),3*p([2,1])]) # needs sage.modules + sage: f.coefficient_cycle_type([1]) # needs sage.modules 1 - sage: f.coefficient_cycle_type([1,1]) # optional - sage.modules + sage: f.coefficient_cycle_type([1,1]) # needs sage.modules 2 - sage: f.coefficient_cycle_type([2,1]) # optional - sage.modules + sage: f.coefficient_cycle_type([2,1]) # needs sage.modules 3 """ t = Partition(t) @@ -334,9 +334,9 @@ def isotype_generating_series(self): EXAMPLES:: sage: P = species.PermutationSpecies() - sage: cis = P.cycle_index_series() # optional - sage.modules - sage: f = cis.isotype_generating_series() # optional - sage.modules - sage: f[:10] # optional - sage.modules + sage: cis = P.cycle_index_series() # needs sage.modules + sage: f = cis.isotype_generating_series() # needs sage.modules + sage: f[:10] # needs sage.modules [1, 1, 2, 3, 5, 7, 11, 15, 22, 30] """ R = self.base_ring() @@ -352,8 +352,8 @@ def _ogs_gen(self, n, ao): EXAMPLES:: sage: P = species.PermutationSpecies() - sage: cis = P.cycle_index_series() # optional - sage.modules - sage: [cis._ogs_gen(i, 0) for i in range(10)] # optional - sage.modules + sage: cis = P.cycle_index_series() # needs sage.modules + sage: [cis._ogs_gen(i, 0) for i in range(10)] # needs sage.modules [1, 1, 2, 3, 5, 7, 11, 15, 22, 30] """ if n < ao: @@ -367,9 +367,9 @@ def generating_series(self): EXAMPLES:: sage: P = species.PartitionSpecies() - sage: cis = P.cycle_index_series() # optional - sage.modules - sage: f = cis.generating_series() # optional - sage.modules - sage: f[:5] # optional - sage.modules + sage: cis = P.cycle_index_series() # needs sage.modules + sage: f = cis.generating_series() # needs sage.modules + sage: f[:5] # needs sage.modules [1, 1, 1, 5/6, 5/8] """ R = self.base_ring() @@ -385,8 +385,8 @@ def _egs_gen(self, n, ao): EXAMPLES:: sage: P = species.PermutationSpecies() - sage: cis = P.cycle_index_series() # optional - sage.modules - sage: [cis._egs_gen(i, 0) for i in range(10)] # optional - sage.modules + sage: cis = P.cycle_index_series() # needs sage.modules + sage: [cis._egs_gen(i, 0) for i in range(10)] # needs sage.modules [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] """ if n < ao: @@ -409,16 +409,16 @@ def derivative(self, n=1): The species `E` of sets satisfies the relationship `E' = E`:: - sage: E = species.SetSpecies().cycle_index_series() # optional - sage.modules - sage: E[:8] == E.derivative()[:8] # optional - sage.modules + sage: E = species.SetSpecies().cycle_index_series() # needs sage.modules + sage: E[:8] == E.derivative()[:8] # needs sage.modules True The species `C` of cyclic orderings and the species `L` of linear orderings satisfy the relationship `C' = L`:: - sage: C = species.CycleSpecies().cycle_index_series() # optional - sage.modules - sage: L = species.LinearOrderSpecies().cycle_index_series() # optional - sage.modules - sage: L[:8] == C.derivative()[:8] # optional - sage.modules + sage: C = species.CycleSpecies().cycle_index_series() # needs sage.modules + sage: L = species.LinearOrderSpecies().cycle_index_series() # needs sage.modules + sage: L[:8] == C.derivative()[:8] # needs sage.modules True """ return self.derivative_with_respect_to_p1(n=n) @@ -439,9 +439,9 @@ def pointing(self): The species `E^{\bullet}` of "pointed sets" satisfies `E^{\bullet} = X \cdot E`:: - sage: E = species.SetSpecies().cycle_index_series() # optional - sage.modules - sage: X = species.SingletonSpecies().cycle_index_series() # optional - sage.modules - sage: E.pointing()[:8] == (X*E)[:8] # optional - sage.modules + sage: E = species.SetSpecies().cycle_index_series() # needs sage.modules + sage: X = species.SingletonSpecies().cycle_index_series() # needs sage.modules + sage: E.pointing()[:8] == (X*E)[:8] # needs sage.modules True """ X = self.parent()([1], valuation=1) @@ -463,9 +463,9 @@ def exponential(self): Let `BT` be the species of binary trees, `BF` the species of binary forests, and `E` the species of sets. Then we have `BF = E \circ BT`:: - sage: BT = species.BinaryTreeSpecies().cycle_index_series() # optional - sage.modules - sage: BF = species.BinaryForestSpecies().cycle_index_series() # optional - sage.modules - sage: BT.exponential().isotype_generating_series()[:8] == BF.isotype_generating_series()[:8] # optional - sage.modules + sage: BT = species.BinaryTreeSpecies().cycle_index_series() # needs sage.modules + sage: BF = species.BinaryForestSpecies().cycle_index_series() # needs sage.modules + sage: BT.exponential().isotype_generating_series()[:8] == BF.isotype_generating_series()[:8] # needs sage.modules True """ base_ring = self.parent().base_ring().base_ring() @@ -490,10 +490,10 @@ def logarithm(self): Let `G` be the species of nonempty graphs and `CG` be the species of nonempty connected graphs. Then `G = E^{+} \circ CG`, so `CG = \Omega \circ G`:: - sage: G = species.SimpleGraphSpecies().cycle_index_series() - 1 # optional - sage.modules + sage: G = species.SimpleGraphSpecies().cycle_index_series() - 1 # needs sage.modules sage: from sage.combinat.species.generating_series import LogarithmCycleIndexSeries - sage: CG = LogarithmCycleIndexSeries()(G) # optional - sage.modules - sage: CG.isotype_generating_series()[0:8] # optional - sage.modules + sage: CG = LogarithmCycleIndexSeries()(G) # needs sage.modules + sage: CG.isotype_generating_series()[0:8] # needs sage.modules [0, 1, 1, 2, 6, 21, 112, 853] """ base_ring = self.parent().base_ring().base_ring() @@ -536,17 +536,17 @@ class CycleIndexSeriesRing(LazySymmetricFunctions): EXAMPLES:: sage: from sage.combinat.species.generating_series import CycleIndexSeriesRing - sage: R = CycleIndexSeriesRing(QQ); R # optional - sage.modules + sage: R = CycleIndexSeriesRing(QQ); R # needs sage.modules Cycle Index Series Ring over Rational Field - sage: p = SymmetricFunctions(QQ).p() # optional - sage.modules - sage: R(lambda n: p[n]) # optional - sage.modules + sage: p = SymmetricFunctions(QQ).p() # needs sage.modules + sage: R(lambda n: p[n]) # needs sage.modules p[] + p[1] + p[2] + p[3] + p[4] + p[5] + p[6] + O^7 TESTS: We test to make sure that caching works:: - sage: R is CycleIndexSeriesRing(QQ) # optional - sage.modules + sage: R is CycleIndexSeriesRing(QQ) # needs sage.modules True """ Element = CycleIndexSeries @@ -559,8 +559,8 @@ def __init__(self, base_ring, sparse=True): sage: from sage.combinat.species.generating_series import CycleIndexSeriesRing sage: CycleIndexSeriesRing.options.halting_precision(12) - sage: R = CycleIndexSeriesRing(QQ) # optional - sage.modules - sage: TestSuite(R).run() # optional - sage.modules + sage: R = CycleIndexSeriesRing(QQ) # needs sage.modules + sage: TestSuite(R).run() # needs sage.modules sage: CycleIndexSeriesRing.options._reset() # reset options """ @@ -574,7 +574,7 @@ def _repr_(self): EXAMPLES:: sage: from sage.combinat.species.generating_series import CycleIndexSeriesRing - sage: CycleIndexSeriesRing(QQ) # optional - sage.modules + sage: CycleIndexSeriesRing(QQ) # needs sage.modules Cycle Index Series Ring over Rational Field """ return "Cycle Index Series Ring over %s" % self.base_ring() @@ -589,7 +589,7 @@ def _exp_term(n, R=QQ): EXAMPLES:: sage: from sage.combinat.species.generating_series import _exp_term - sage: [_exp_term(i) for i in range(4)] # optional - sage.modules + sage: [_exp_term(i) for i in range(4)] # needs sage.modules [p[], p[1], 1/2*p[1, 1] + 1/2*p[2], 1/6*p[1, 1, 1] + 1/2*p[2, 1] + 1/3*p[3]] """ p = SymmetricFunctions(R).power() @@ -611,7 +611,7 @@ def ExponentialCycleIndexSeries(R=QQ): EXAMPLES:: sage: from sage.combinat.species.generating_series import ExponentialCycleIndexSeries - sage: ExponentialCycleIndexSeries()[:5] # optional - sage.modules + sage: ExponentialCycleIndexSeries()[:5] # needs sage.modules [p[], p[1], 1/2*p[1, 1] + 1/2*p[2], 1/6*p[1, 1, 1] + 1/2*p[2, 1] + 1/3*p[3], 1/24*p[1, 1, 1, 1] + 1/4*p[2, 1, 1] + 1/8*p[2, 2] + 1/3*p[3, 1] + 1/4*p[4]] @@ -630,7 +630,7 @@ def _cl_term(n, R=QQ): EXAMPLES:: sage: from sage.combinat.species.generating_series import _cl_term - sage: [_cl_term(i) for i in range(4)] # optional - sage.modules + sage: [_cl_term(i) for i in range(4)] # needs sage.modules [0, p[1], -1/2*p[1, 1] - 1/2*p[2], 1/3*p[1, 1, 1] - 1/3*p[3]] """ n = Integer(n) # check that n is an integer @@ -662,15 +662,15 @@ def LogarithmCycleIndexSeries(R=QQ): its cycle index has negative coefficients:: sage: from sage.combinat.species.generating_series import LogarithmCycleIndexSeries - sage: LogarithmCycleIndexSeries()[0:4] # optional - sage.modules + sage: LogarithmCycleIndexSeries()[0:4] # needs sage.modules [0, p[1], -1/2*p[1, 1] - 1/2*p[2], 1/3*p[1, 1, 1] - 1/3*p[3]] Its defining property is that `\Omega \circ E^{+} = E^{+} \circ \Omega = X` (that is, that composition with `E^{+}` in both directions yields the multiplicative identity `X`):: - sage: Eplus = sage.combinat.species.set_species.SetSpecies(min=1).cycle_index_series() # optional - sage.modules - sage: LogarithmCycleIndexSeries()(Eplus)[0:4] # optional - sage.modules + sage: Eplus = sage.combinat.species.set_species.SetSpecies(min=1).cycle_index_series() # needs sage.modules + sage: LogarithmCycleIndexSeries()(Eplus)[0:4] # needs sage.modules [0, p[1], 0, 0] """ CIS = CycleIndexSeriesRing(R) diff --git a/src/sage/combinat/species/library.py b/src/sage/combinat/species/library.py index 3e3025d87f6..c50a9fe75fa 100644 --- a/src/sage/combinat/species/library.py +++ b/src/sage/combinat/species/library.py @@ -43,25 +43,25 @@ def SimpleGraphSpecies(): sage: S = species.SimpleGraphSpecies() sage: S.generating_series().counts(10) [1, 1, 2, 8, 64, 1024, 32768, 2097152, 268435456, 68719476736] - sage: S.cycle_index_series()[:5] # optional - sage.modules + sage: S.cycle_index_series()[:5] # needs sage.modules [p[], p[1], p[1, 1] + p[2], 4/3*p[1, 1, 1] + 2*p[2, 1] + 2/3*p[3], 8/3*p[1, 1, 1, 1] + 4*p[2, 1, 1] + 2*p[2, 2] + 4/3*p[3, 1] + p[4]] - sage: S.isotype_generating_series()[:6] # optional - sage.modules + sage: S.isotype_generating_series()[:6] # needs sage.modules [1, 1, 2, 4, 11, 34] TESTS:: - sage: seq = S.isotype_generating_series().counts(6)[1:] # optional - sage.modules - sage: oeis(seq)[0] # optional -- internet # optional - sage.modules + sage: seq = S.isotype_generating_series().counts(6)[1:] # needs sage.modules + sage: oeis(seq)[0] # optional - internet # needs sage.modules A000088: Number of graphs on n unlabeled nodes. :: - sage: seq = S.generating_series().counts(10)[1:] # optional - sage.modules - sage: oeis(seq)[0] # optional -- internet # optional - sage.modules + sage: seq = S.generating_series().counts(10)[1:] # needs sage.modules + sage: oeis(seq)[0] # optional - internet # needs sage.modules A006125: a(n) = 2^(n*(n-1)/2). """ E = SetSpecies() @@ -94,7 +94,7 @@ def BinaryTreeSpecies(): sage: B = species.BinaryTreeSpecies() sage: a = B.structures([1,2,3,4,5])[187]; a 2*((5*3)*(4*1)) - sage: a.automorphism_group() # optional - sage.groups + sage: a.automorphism_group() # needs sage.groups Permutation Group with generators [()] TESTS:: @@ -121,9 +121,9 @@ def BinaryForestSpecies(): sage: F = species.BinaryForestSpecies() sage: F.generating_series().counts(10) [1, 1, 3, 19, 193, 2721, 49171, 1084483, 28245729, 848456353] - sage: F.isotype_generating_series().counts(10) # optional - sage.modules + sage: F.isotype_generating_series().counts(10) # needs sage.modules [1, 1, 2, 4, 10, 26, 77, 235, 758, 2504] - sage: F.cycle_index_series()[:7] # optional - sage.modules + sage: F.cycle_index_series()[:7] # needs sage.modules [p[], p[1], 3/2*p[1, 1] + 1/2*p[2], @@ -134,8 +134,8 @@ def BinaryForestSpecies(): TESTS:: - sage: seq = F.isotype_generating_series().counts(10)[1:] # optional - sage.modules - sage: oeis(seq)[0] # optional -- internet # optional - sage.modules + sage: seq = F.isotype_generating_series().counts(10)[1:] # needs sage.modules + sage: oeis(seq)[0] # optional - internet # needs sage.modules A052854: Number of forests of ordered trees on n total nodes. """ B = BinaryTreeSpecies() diff --git a/src/sage/combinat/species/linear_order_species.py b/src/sage/combinat/species/linear_order_species.py index a889c8ab6c2..0761dea576d 100644 --- a/src/sage/combinat/species/linear_order_species.py +++ b/src/sage/combinat/species/linear_order_species.py @@ -43,8 +43,8 @@ def transport(self, perm): sage: F = species.LinearOrderSpecies() sage: a = F.structures(["a", "b", "c"])[0]; a ['a', 'b', 'c'] - sage: p = PermutationGroupElement((1,2)) # optional - sage.groups - sage: a.transport(p) # optional - sage.groups + sage: p = PermutationGroupElement((1,2)) # needs sage.groups + sage: a.transport(p) # needs sage.groups ['b', 'a', 'c'] """ return LinearOrderSpeciesStructure(self.parent(), self._labels, [perm(i) for i in self._list]) @@ -60,7 +60,7 @@ def automorphism_group(self): sage: F = species.LinearOrderSpecies() sage: a = F.structures(["a", "b", "c"])[0]; a ['a', 'b', 'c'] - sage: a.automorphism_group() # optional - sage.groups + sage: a.automorphism_group() # needs sage.groups Symmetric group of order 1! as a permutation group """ from sage.groups.perm_gps.permgroup_named import SymmetricGroup @@ -155,8 +155,8 @@ def _cis_callable(self, base_ring, n): EXAMPLES:: sage: L = species.LinearOrderSpecies() - sage: g = L.cycle_index_series() # optional - sage.modules - sage: g[0:5] # optional - sage.modules + sage: g = L.cycle_index_series() # needs sage.modules + sage: g[0:5] # needs sage.modules [p[], p[1], p[1, 1], p[1, 1, 1], p[1, 1, 1, 1]] """ from sage.combinat.sf.sf import SymmetricFunctions diff --git a/src/sage/combinat/species/partition_species.py b/src/sage/combinat/species/partition_species.py index f3038ad6ba2..bd24f470402 100644 --- a/src/sage/combinat/species/partition_species.py +++ b/src/sage/combinat/species/partition_species.py @@ -272,7 +272,7 @@ def _cis(self, series_ring, base_ring): EXAMPLES:: sage: P = species.PartitionSpecies() - sage: g = P.cycle_index_series() # optional - sage.modules + sage: g = P.cycle_index_series() # needs sage.modules sage: g[0:5] [p[], p[1], diff --git a/src/sage/combinat/species/permutation_species.py b/src/sage/combinat/species/permutation_species.py index 470a766a2c4..59f41bbad0a 100644 --- a/src/sage/combinat/species/permutation_species.py +++ b/src/sage/combinat/species/permutation_species.py @@ -225,8 +225,8 @@ def _cis(self, series_ring, base_ring): EXAMPLES:: sage: P = species.PermutationSpecies() - sage: g = P.cycle_index_series() # optional - sage.modules - sage: g[0:5] # optional - sage.modules + sage: g = P.cycle_index_series() # needs sage.modules + sage: g[0:5] # needs sage.modules [p[], p[1], p[1, 1] + p[2], @@ -244,7 +244,7 @@ def _cis_gen(self, base_ring, m, n): EXAMPLES:: sage: P = species.PermutationSpecies() - sage: [P._cis_gen(QQ, 2, i) for i in range(10)] # optional - sage.modules + sage: [P._cis_gen(QQ, 2, i) for i in range(10)] # needs sage.modules [p[], 0, p[2], 0, p[2, 2], 0, p[2, 2, 2], 0, p[2, 2, 2, 2], 0] """ from sage.combinat.sf.sf import SymmetricFunctions diff --git a/src/sage/combinat/species/product_species.py b/src/sage/combinat/species/product_species.py index b1ce34596fd..41cd958532f 100644 --- a/src/sage/combinat/species/product_species.py +++ b/src/sage/combinat/species/product_species.py @@ -58,12 +58,12 @@ def transport(self, perm): """ EXAMPLES:: - sage: p = PermutationGroupElement((2,3)) # optional - sage.groups - sage: S = species.SetSpecies() # optional - sage.groups - sage: F = S * S # optional - sage.groups - sage: a = F.structures(['a','b','c'])[4]; a # optional - sage.groups + sage: p = PermutationGroupElement((2,3)) # needs sage.groups + sage: S = species.SetSpecies() # needs sage.groups + sage: F = S * S # needs sage.groups + sage: a = F.structures(['a','b','c'])[4]; a # needs sage.groups {'a', 'b'}*{'c'} - sage: a.transport(p) # optional - sage.groups + sage: a.transport(p) # needs sage.groups {'a', 'c'}*{'b'} """ left, right = self._list @@ -151,17 +151,17 @@ def automorphism_group(self): """ EXAMPLES:: - sage: p = PermutationGroupElement((2,3)) # optional - sage.groups - sage: S = species.SetSpecies() # optional - sage.groups - sage: F = S * S # optional - sage.groups - sage: a = F.structures([1,2,3,4])[1]; a # optional - sage.groups + sage: p = PermutationGroupElement((2,3)) # needs sage.groups + sage: S = species.SetSpecies() # needs sage.groups + sage: F = S * S # needs sage.groups + sage: a = F.structures([1,2,3,4])[1]; a # needs sage.groups {1}*{2, 3, 4} - sage: a.automorphism_group() # optional - sage.groups + sage: a.automorphism_group() # needs sage.groups Permutation Group with generators [(2,3), (2,3,4)] :: - sage: [a.transport(g) for g in a.automorphism_group()] # optional - sage.groups + sage: [a.transport(g) for g in a.automorphism_group()] # needs sage.groups [{1}*{2, 3, 4}, {1}*{2, 3, 4}, {1}*{2, 3, 4}, @@ -171,9 +171,9 @@ def automorphism_group(self): :: - sage: a = F.structures([1,2,3,4])[8]; a # optional - sage.groups + sage: a = F.structures([1,2,3,4])[8]; a # needs sage.groups {2, 3}*{1, 4} - sage: [a.transport(g) for g in a.automorphism_group()] # optional - sage.groups + sage: [a.transport(g) for g in a.automorphism_group()] # needs sage.groups [{2, 3}*{1, 4}, {2, 3}*{1, 4}, {2, 3}*{1, 4}, {2, 3}*{1, 4}] """ from sage.groups.perm_gps.constructor import PermutationGroupElement @@ -215,7 +215,7 @@ def __init__(self, F, G, min=None, max=None, weight=None): Product of (Permutation species) and (Permutation species) sage: F == loads(dumps(F)) True - sage: F._check() # optional - sage.libs.flint + sage: F._check() # needs sage.libs.flint True TESTS:: @@ -340,7 +340,7 @@ def _itgs(self, series_ring, base_ring): sage: P = species.PermutationSpecies() sage: F = P * P - sage: F.isotype_generating_series()[0:5] # optional - sage.libs.flint + sage: F.isotype_generating_series()[0:5] # needs sage.libs.flint [1, 2, 5, 10, 20] """ res = (self.left_factor().isotype_generating_series(base_ring) * @@ -355,7 +355,7 @@ def _cis(self, series_ring, base_ring): sage: P = species.PermutationSpecies() sage: F = P * P - sage: F.cycle_index_series()[0:5] # optional - sage.modules + sage: F.cycle_index_series()[0:5] # needs sage.modules [p[], 2*p[1], 3*p[1, 1] + 2*p[2], @@ -409,7 +409,7 @@ def _equation(self, var_mapping): sage: X = species.SingletonSpecies() sage: S = X * X - sage: S.algebraic_equation_system() # optional - sage.graphs + sage: S.algebraic_equation_system() # needs sage.graphs [node0 + (-z^2)] """ from sage.misc.misc_c import prod diff --git a/src/sage/combinat/species/recursive_species.py b/src/sage/combinat/species/recursive_species.py index a87bb27866b..8eaabf0d2a8 100644 --- a/src/sage/combinat/species/recursive_species.py +++ b/src/sage/combinat/species/recursive_species.py @@ -263,7 +263,7 @@ def _cis(self, series_ring, base_ring): EXAMPLES:: sage: F = CombinatorialSpecies() - sage: F.cycle_index_series() # optional - sage.modules + sage: F.cycle_index_series() # needs sage.modules Uninitialized Lazy Series """ if base_ring not in self._cycle_index_series: @@ -429,17 +429,17 @@ def _add_to_digraph(self, d): EXAMPLES:: - sage: d = DiGraph(multiedges=True) # optional - sage.graphs + sage: d = DiGraph(multiedges=True) # needs sage.graphs sage: X = species.SingletonSpecies() sage: B = species.CombinatorialSpecies() sage: B.define(X+B*B) - sage: B._add_to_digraph(d); d # optional - sage.graphs + sage: B._add_to_digraph(d); d # needs sage.graphs Multi-digraph on 4 vertices TESTS:: sage: C = species.CombinatorialSpecies() - sage: C._add_to_digraph(d) # optional - sage.graphs + sage: C._add_to_digraph(d) # needs sage.graphs Traceback (most recent call last): ... NotImplementedError @@ -461,7 +461,7 @@ def _equation(self, var_mapping): EXAMPLES:: sage: C = species.CombinatorialSpecies() - sage: C.algebraic_equation_system() # optional - sage.graphs + sage: C.algebraic_equation_system() # needs sage.graphs Traceback (most recent call last): ... NotImplementedError @@ -469,7 +469,7 @@ def _equation(self, var_mapping): :: sage: B = species.BinaryTreeSpecies() - sage: B.algebraic_equation_system() # optional - sage.graphs + sage: B.algebraic_equation_system() # needs sage.graphs [-node3^2 + node1, -node1 + node3 + (-z)] """ try: diff --git a/src/sage/combinat/species/set_species.py b/src/sage/combinat/species/set_species.py index 31020f8eb5e..94aa893cf46 100644 --- a/src/sage/combinat/species/set_species.py +++ b/src/sage/combinat/species/set_species.py @@ -57,8 +57,8 @@ def transport(self, perm): sage: F = species.SetSpecies() sage: a = F.structures(["a", "b", "c"]).random_element(); a {'a', 'b', 'c'} - sage: p = PermutationGroupElement((1,2)) # optional - sage.groups - sage: a.transport(p) # optional - sage.groups + sage: p = PermutationGroupElement((1,2)) # needs sage.groups + sage: a.transport(p) # needs sage.groups {'a', 'b', 'c'} """ return self @@ -74,7 +74,7 @@ def automorphism_group(self): sage: F = species.SetSpecies() sage: a = F.structures(["a", "b", "c"]).random_element(); a {'a', 'b', 'c'} - sage: a.automorphism_group() # optional - sage.groups + sage: a.automorphism_group() # needs sage.groups Symmetric group of order 3! as a permutation group """ from sage.groups.perm_gps.permgroup_named import SymmetricGroup @@ -170,8 +170,8 @@ def _cis(self, series_ring, base_ring): EXAMPLES:: sage: S = species.SetSpecies() - sage: g = S.cycle_index_series() # optional - sage.modules - sage: g[0:5] # optional - sage.modules + sage: g = S.cycle_index_series() # needs sage.modules + sage: g[0:5] # needs sage.modules [p[], p[1], 1/2*p[1, 1] + 1/2*p[2], diff --git a/src/sage/combinat/species/species.py b/src/sage/combinat/species/species.py index 0efdb963981..2b505567433 100644 --- a/src/sage/combinat/species/species.py +++ b/src/sage/combinat/species/species.py @@ -24,12 +24,12 @@ sage: L = species.LinearOrderSpecies(min=1) sage: T = species.CombinatorialSpecies(min=1) sage: T.define(leaf + internal_node*L(T)) - sage: T.isotype_generating_series()[0:6] # optional - sage.modules + sage: T.isotype_generating_series()[0:6] # needs sage.modules [0, 1, q, q^2 + q, q^3 + 3*q^2 + q, q^4 + 6*q^3 + 6*q^2 + q] Consider the following:: - sage: T.isotype_generating_series().coefficient(4) # optional - sage.modules + sage: T.isotype_generating_series().coefficient(4) # needs sage.modules q^3 + 3*q^2 + q This means that, among the trees on `4` nodes, one has a @@ -335,7 +335,7 @@ def functorial_composition(self, g): sage: WP = species.SubsetSpecies() sage: P2 = E2*E sage: G = WP.functorial_composition(P2) - sage: G.isotype_generating_series()[0:5] # optional - sage.modules + sage: G.isotype_generating_series()[0:5] # needs sage.modules [1, 1, 2, 4, 11] """ from .functorial_composition_species import FunctorialCompositionSpecies @@ -401,7 +401,7 @@ def _check(self, n=5): EXAMPLES:: sage: P = species.PartitionSpecies() - sage: P._check() # optional - sage.libs.flint + sage: P._check() # needs sage.libs.flint True """ st = self.structures(range(n)) @@ -448,7 +448,7 @@ def __pow__(self, n): sage: X^1 is X True sage: A = X^32 - sage: A.digraph() # optional - sage.graphs + sage: A.digraph() # needs sage.graphs Multi-digraph on 6 vertices TESTS:: @@ -622,13 +622,13 @@ def isotype_generating_series(self, base_ring=None): sage: P = species.PermutationSpecies() sage: g = P.isotype_generating_series() - sage: g[0:4] # optional - sage.libs.flint + sage: g[0:4] # needs sage.libs.flint [1, 1, 2, 3] - sage: g.counts(4) # optional - sage.libs.flint + sage: g.counts(4) # needs sage.libs.flint [1, 1, 2, 3] - sage: P.isotypes([1,2,3]).list() # optional - sage.libs.flint + sage: P.isotypes([1,2,3]).list() # needs sage.libs.flint [[2, 3, 1], [2, 1, 3], [1, 2, 3]] - sage: len(_) # optional - sage.libs.flint + sage: len(_) # needs sage.libs.flint 3 """ return self._get_series(OrdinaryGeneratingSeriesRing, "itgs", base_ring) @@ -643,8 +643,8 @@ def cycle_index_series(self, base_ring=None): EXAMPLES:: sage: P = species.PermutationSpecies() - sage: g = P.cycle_index_series() # optional - sage.modules - sage: g[0:4] # optional - sage.modules + sage: g = P.cycle_index_series() # needs sage.modules + sage: g[0:4] # needs sage.modules [p[], p[1], p[1, 1] + p[2], p[1, 1, 1] + p[2, 1] + p[3]] """ return self._get_series(CycleIndexSeriesRing, "cis", base_ring) @@ -710,19 +710,19 @@ def digraph(self): sage: X = species.SingletonSpecies() sage: B = species.CombinatorialSpecies() sage: B.define(X+B*B) - sage: g = B.digraph(); g # optional - sage.graphs + sage: g = B.digraph(); g # needs sage.graphs Multi-digraph on 4 vertices - sage: sorted(g, key=str) # optional - sage.graphs + sage: sorted(g, key=str) # needs sage.graphs [Combinatorial species, Product of (Combinatorial species) and (Combinatorial species), Singleton species, Sum of (Singleton species) and (Product of (Combinatorial species) and (Combinatorial species))] - sage: d = {sp: i for i, sp in enumerate(g)} # optional - sage.graphs - sage: g.relabel(d) # optional - sage.graphs - sage: g.canonical_label().edges(sort=True) # optional - sage.graphs + sage: d = {sp: i for i, sp in enumerate(g)} # needs sage.graphs + sage: g.relabel(d) # needs sage.graphs + sage: g.canonical_label().edges(sort=True) # needs sage.graphs [(0, 3, None), (2, 0, None), (2, 0, None), (3, 1, None), (3, 2, None)] """ from sage.graphs.digraph import DiGraph @@ -739,13 +739,13 @@ def _add_to_digraph(self, d): EXAMPLES:: - sage: d = DiGraph(multiedges=True) # optional - sage.graphs - sage: X = species.SingletonSpecies() # optional - sage.graphs - sage: X._add_to_digraph(d); d # optional - sage.graphs + sage: d = DiGraph(multiedges=True) # needs sage.graphs + sage: X = species.SingletonSpecies() # needs sage.graphs + sage: X._add_to_digraph(d); d # needs sage.graphs Multi-digraph on 1 vertex - sage: (X+X)._add_to_digraph(d); d # optional - sage.graphs + sage: (X+X)._add_to_digraph(d); d # needs sage.graphs Multi-digraph on 2 vertices - sage: d.edges(sort=True) # optional - sage.graphs + sage: d.edges(sort=True) # needs sage.graphs [(Sum of (Singleton species) and (Singleton species), Singleton species, None), (Sum of (Singleton species) and (Singleton species), Singleton species, None)] """ @@ -770,12 +770,12 @@ def algebraic_equation_system(self): EXAMPLES:: sage: B = species.BinaryTreeSpecies() - sage: B.algebraic_equation_system() # optional - sage.graphs + sage: B.algebraic_equation_system() # needs sage.graphs [-node3^2 + node1, -node1 + node3 + (-z)] :: - sage: sorted(B.digraph().vertex_iterator(), key=str) # optional - sage.graphs + sage: sorted(B.digraph().vertex_iterator(), key=str) # needs sage.graphs [Combinatorial species with min=1, Product of (Combinatorial species with min=1) and (Combinatorial species with min=1), @@ -786,7 +786,7 @@ def algebraic_equation_system(self): :: - sage: B.algebraic_equation_system()[0].parent() # optional - sage.graphs + sage: B.algebraic_equation_system()[0].parent() # needs sage.graphs Multivariate Polynomial Ring in node0, node1, node2, node3 over Fraction Field of Univariate Polynomial Ring in z over Rational Field """ diff --git a/src/sage/combinat/species/structure.py b/src/sage/combinat/species/structure.py index 6dc1fc2ea15..b3003ed0f13 100644 --- a/src/sage/combinat/species/structure.py +++ b/src/sage/combinat/species/structure.py @@ -16,8 +16,8 @@ sage: bar = species.EmptySetSpecies() sage: BB = CombinatorialSpecies() sage: BB.define(ball + ball*BB + ball*bar*BB) - sage: o = var('o') # optional - sage.symbolic - sage: BB.isotypes([o]*3).list() # optional - sage.symbolic + sage: o = var('o') # needs sage.symbolic + sage: BB.isotypes([o]*3).list() # needs sage.symbolic [o*(o*o), o*((o*{})*o), (o*{})*(o*o), (o*{})*((o*{})*o)] If we ignore the parentheses, we can read off that the integer @@ -277,9 +277,9 @@ def transport(self, perm): EXAMPLES:: sage: P = species.PartitionSpecies() - sage: s = (P+P).structures([1,2,3])[1]; s # optional - sage.libs.flint + sage: s = (P+P).structures([1,2,3])[1]; s # needs sage.libs.flint {{1, 3}, {2}} - sage: s.transport(PermutationGroupElement((2,3))) # optional - sage.groups sage.libs.flint + sage: s.transport(PermutationGroupElement((2,3))) # needs sage.groups sage.libs.flint {{1, 2}, {3}} """ return self.__class__(self._parent, self._s.transport(perm), **self._options) @@ -289,9 +289,9 @@ def canonical_label(self): EXAMPLES:: sage: P = species.PartitionSpecies() - sage: s = (P+P).structures([1,2,3])[1]; s # optional - sage.libs.flint + sage: s = (P+P).structures([1,2,3])[1]; s # needs sage.libs.flint {{1, 3}, {2}} - sage: s.canonical_label() # optional - sage.libs.flint + sage: s.canonical_label() # needs sage.libs.flint {{1, 2}, {3}} """ return self.__class__(self._parent, self._s.canonical_label(), **self._options) diff --git a/src/sage/combinat/species/subset_species.py b/src/sage/combinat/species/subset_species.py index 2d3b9f8dcb6..2e7a6697e29 100644 --- a/src/sage/combinat/species/subset_species.py +++ b/src/sage/combinat/species/subset_species.py @@ -74,11 +74,11 @@ def transport(self, perm): sage: F = species.SubsetSpecies() sage: a = F.structures(["a", "b", "c"])[5]; a {'a', 'c'} - sage: p = PermutationGroupElement((1,2)) # optional - sage.groups - sage: a.transport(p) # optional - sage.groups + sage: p = PermutationGroupElement((1,2)) # needs sage.groups + sage: a.transport(p) # needs sage.groups {'b', 'c'} - sage: p = PermutationGroupElement((1,3)) # optional - sage.groups - sage: a.transport(p) # optional - sage.groups + sage: p = PermutationGroupElement((1,3)) # needs sage.groups + sage: a.transport(p) # needs sage.groups {'a', 'c'} """ l = sorted([perm(i) for i in self._list]) @@ -94,12 +94,12 @@ def automorphism_group(self): sage: F = species.SubsetSpecies() sage: a = F.structures([1,2,3,4])[6]; a {1, 3} - sage: a.automorphism_group() # optional - sage.groups + sage: a.automorphism_group() # needs sage.groups Permutation Group with generators [(2,4), (1,3)] :: - sage: [a.transport(g) for g in a.automorphism_group()] # optional - sage.groups + sage: [a.transport(g) for g in a.automorphism_group()] # needs sage.groups [{1, 3}, {1, 3}, {1, 3}, {1, 3}] """ from sage.groups.perm_gps.permgroup_named import SymmetricGroup @@ -224,7 +224,7 @@ def _cis(self, series_ring, base_ring): EXAMPLES:: sage: S = species.SubsetSpecies() - sage: S.cycle_index_series()[0:5] # optional - sage.modules + sage: S.cycle_index_series()[0:5] # needs sage.modules [p[], 2*p[1], 2*p[1, 1] + p[2], diff --git a/src/sage/combinat/species/sum_species.py b/src/sage/combinat/species/sum_species.py index ac2e05943b3..b3ff129dc55 100644 --- a/src/sage/combinat/species/sum_species.py +++ b/src/sage/combinat/species/sum_species.py @@ -38,7 +38,7 @@ def __init__(self, F, G, min=None, max=None, weight=None): sage: P = species.PermutationSpecies() sage: F = P + P - sage: F._check() # optional - sage.libs.flint + sage: F._check() # needs sage.libs.flint True sage: F == loads(dumps(F)) True @@ -126,7 +126,7 @@ def _isotypes(self, structure_class, labels): sage: P = species.PermutationSpecies() sage: F = P + P - sage: F.isotypes([1,2]).list() # optional - sage.libs.flint + sage: F.isotypes([1,2]).list() # needs sage.libs.flint [[2, 1], [1, 2], [2, 1], [1, 2]] """ for res in self._F.isotypes(labels): @@ -157,7 +157,7 @@ def _itgs(self, series_ring, base_ring): sage: P = species.PermutationSpecies() sage: F = P + P - sage: F.isotype_generating_series()[:5] # optional - sage.libs.flint + sage: F.isotype_generating_series()[:5] # needs sage.libs.flint [2, 2, 4, 6, 10] """ return (self.left_summand().isotype_generating_series(base_ring) + @@ -171,7 +171,7 @@ def _cis(self, series_ring, base_ring): sage: P = species.PermutationSpecies() sage: F = P + P - sage: F.cycle_index_series()[:5] # optional - sage.modules + sage: F.cycle_index_series()[:5] # needs sage.modules [2*p[], 2*p[1], 2*p[1, 1] + 2*p[2], @@ -214,7 +214,7 @@ def _equation(self, var_mapping): sage: X = species.SingletonSpecies() sage: S = X + X - sage: S.algebraic_equation_system() # optional - sage.graphs + sage: S.algebraic_equation_system() # needs sage.graphs [node1 + (-2*z)] """ return sum(var_mapping[operand] for operand in self._state_info) From bddb7fc8c5e89cbaa79a25225699436bc0820468 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 13 Jul 2023 23:26:30 -0700 Subject: [PATCH 7/8] sage.combinat.species: Update # needs --- .../combinat/species/composition_species.py | 19 ++++---- .../combinat/species/generating_series.py | 45 ++++++++++--------- .../combinat/species/partition_species.py | 2 +- src/sage/combinat/species/product_species.py | 22 ++++----- src/sage/combinat/species/species.py | 11 ++--- 5 files changed, 53 insertions(+), 46 deletions(-) diff --git a/src/sage/combinat/species/composition_species.py b/src/sage/combinat/species/composition_species.py index a60b0cbed89..b60e5348985 100644 --- a/src/sage/combinat/species/composition_species.py +++ b/src/sage/combinat/species/composition_species.py @@ -145,21 +145,22 @@ def _structures(self, structure_class, labels): TESTS:: - sage: a = _[2] # needs sage.libs.flint - sage: f, gs = a._list # needs sage.libs.flint - sage: f # needs sage.libs.flint + sage: # needs sage.libs.flint + sage: a = _[2] + sage: f, gs = a._list + sage: f {{'a', 'c'}, {'b'}} - sage: f.parent() # needs sage.libs.flint + sage: f.parent() Set species - sage: f._list # needs sage.libs.flint + sage: f._list [1, 2] - sage: f._labels # needs sage.libs.flint + sage: f._labels [{'a', 'c'}, {'b'}] - sage: [g.parent() for g in gs] # needs sage.libs.flint + sage: [g.parent() for g in gs] [Cyclic permutation species, Cyclic permutation species] - sage: [g._labels for g in gs] # needs sage.libs.flint + sage: [g._labels for g in gs] [['a', 'c'], ['b']] - sage: [g._list for g in gs] # needs sage.libs.flint + sage: [g._list for g in gs] [[1, 2], [1]] """ from itertools import product diff --git a/src/sage/combinat/species/generating_series.py b/src/sage/combinat/species/generating_series.py index 9c0515bbead..c585634d314 100644 --- a/src/sage/combinat/species/generating_series.py +++ b/src/sage/combinat/species/generating_series.py @@ -15,19 +15,20 @@ TESTS:: + sage: # needs sage.modules sage: from sage.combinat.species.generating_series import CycleIndexSeriesRing - sage: p = SymmetricFunctions(QQ).power() # needs sage.modules - sage: CIS = CycleIndexSeriesRing(QQ) # needs sage.modules - sage: geo1 = CIS(lambda i: p([1])^i) # needs sage.modules - sage: geo2 = CIS(lambda i: p([2])^(i // 2) if is_even(i) else 0) # needs sage.modules - sage: s = geo1 * geo2 # needs sage.modules - sage: s[0] # needs sage.modules + sage: p = SymmetricFunctions(QQ).power() + sage: CIS = CycleIndexSeriesRing(QQ) + sage: geo1 = CIS(lambda i: p([1])^i) + sage: geo2 = CIS(lambda i: p([2])^(i // 2) if is_even(i) else 0) + sage: s = geo1 * geo2 + sage: s[0] p[] - sage: s[1] # needs sage.modules + sage: s[1] p[1] - sage: s[2] # needs sage.modules + sage: s[2] p[1, 1] + p[2] - sage: s[3] # needs sage.modules + sage: s[3] p[1, 1, 1] + p[2, 1] REFERENCES: @@ -292,15 +293,16 @@ def count(self, t): EXAMPLES:: + sage: # needs sage.modules sage: from sage.combinat.species.generating_series import CycleIndexSeriesRing - sage: p = SymmetricFunctions(QQ).power() # needs sage.modules - sage: CIS = CycleIndexSeriesRing(QQ) # needs sage.modules - sage: f = CIS([0, p([1]), 2*p([1,1]), 3*p([2,1])]) # needs sage.modules - sage: f.count([1]) # needs sage.modules + sage: p = SymmetricFunctions(QQ).power() + sage: CIS = CycleIndexSeriesRing(QQ) + sage: f = CIS([0, p([1]), 2*p([1,1]), 3*p([2,1])]) + sage: f.count([1]) 1 - sage: f.count([1,1]) # needs sage.modules + sage: f.count([1,1]) 4 - sage: f.count([2,1]) # needs sage.modules + sage: f.count([2,1]) 6 """ t = Partition(t) @@ -312,15 +314,16 @@ def coefficient_cycle_type(self, t): EXAMPLES:: + sage: # needs sage.modules sage: from sage.combinat.species.generating_series import CycleIndexSeriesRing - sage: p = SymmetricFunctions(QQ).power() # needs sage.modules - sage: CIS = CycleIndexSeriesRing(QQ) # needs sage.modules - sage: f = CIS([0, p([1]), 2*p([1,1]),3*p([2,1])]) # needs sage.modules - sage: f.coefficient_cycle_type([1]) # needs sage.modules + sage: p = SymmetricFunctions(QQ).power() + sage: CIS = CycleIndexSeriesRing(QQ) + sage: f = CIS([0, p([1]), 2*p([1,1]),3*p([2,1])]) + sage: f.coefficient_cycle_type([1]) 1 - sage: f.coefficient_cycle_type([1,1]) # needs sage.modules + sage: f.coefficient_cycle_type([1,1]) 2 - sage: f.coefficient_cycle_type([2,1]) # needs sage.modules + sage: f.coefficient_cycle_type([2,1]) 3 """ t = Partition(t) diff --git a/src/sage/combinat/species/partition_species.py b/src/sage/combinat/species/partition_species.py index bd24f470402..21a57197ccd 100644 --- a/src/sage/combinat/species/partition_species.py +++ b/src/sage/combinat/species/partition_species.py @@ -273,7 +273,7 @@ def _cis(self, series_ring, base_ring): sage: P = species.PartitionSpecies() sage: g = P.cycle_index_series() # needs sage.modules - sage: g[0:5] + sage: g[0:5] # needs sage.modules [p[], p[1], p[1, 1] + p[2], diff --git a/src/sage/combinat/species/product_species.py b/src/sage/combinat/species/product_species.py index 41cd958532f..90209e64776 100644 --- a/src/sage/combinat/species/product_species.py +++ b/src/sage/combinat/species/product_species.py @@ -58,12 +58,13 @@ def transport(self, perm): """ EXAMPLES:: - sage: p = PermutationGroupElement((2,3)) # needs sage.groups - sage: S = species.SetSpecies() # needs sage.groups - sage: F = S * S # needs sage.groups - sage: a = F.structures(['a','b','c'])[4]; a # needs sage.groups + sage: # needs sage.groups + sage: p = PermutationGroupElement((2,3)) + sage: S = species.SetSpecies() + sage: F = S * S + sage: a = F.structures(['a','b','c'])[4]; a {'a', 'b'}*{'c'} - sage: a.transport(p) # needs sage.groups + sage: a.transport(p) {'a', 'c'}*{'b'} """ left, right = self._list @@ -151,12 +152,13 @@ def automorphism_group(self): """ EXAMPLES:: - sage: p = PermutationGroupElement((2,3)) # needs sage.groups - sage: S = species.SetSpecies() # needs sage.groups - sage: F = S * S # needs sage.groups - sage: a = F.structures([1,2,3,4])[1]; a # needs sage.groups + sage: # needs sage.groups + sage: p = PermutationGroupElement((2,3)) + sage: S = species.SetSpecies() + sage: F = S * S + sage: a = F.structures([1,2,3,4])[1]; a {1}*{2, 3, 4} - sage: a.automorphism_group() # needs sage.groups + sage: a.automorphism_group() Permutation Group with generators [(2,3), (2,3,4)] :: diff --git a/src/sage/combinat/species/species.py b/src/sage/combinat/species/species.py index 2b505567433..d3f1e9d3867 100644 --- a/src/sage/combinat/species/species.py +++ b/src/sage/combinat/species/species.py @@ -739,13 +739,14 @@ def _add_to_digraph(self, d): EXAMPLES:: - sage: d = DiGraph(multiedges=True) # needs sage.graphs - sage: X = species.SingletonSpecies() # needs sage.graphs - sage: X._add_to_digraph(d); d # needs sage.graphs + sage: # needs sage.graphs + sage: d = DiGraph(multiedges=True) + sage: X = species.SingletonSpecies() + sage: X._add_to_digraph(d); d Multi-digraph on 1 vertex - sage: (X+X)._add_to_digraph(d); d # needs sage.graphs + sage: (X+X)._add_to_digraph(d); d Multi-digraph on 2 vertices - sage: d.edges(sort=True) # needs sage.graphs + sage: d.edges(sort=True) [(Sum of (Singleton species) and (Singleton species), Singleton species, None), (Sum of (Singleton species) and (Singleton species), Singleton species, None)] """ From 81dfb7bce2a04bac66050dc69c361fa7939088ba Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 4 Nov 2023 10:29:24 -0700 Subject: [PATCH 8/8] src/sage/combinat/species/partition_species.py: Fix indentation --- src/sage/combinat/species/partition_species.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/combinat/species/partition_species.py b/src/sage/combinat/species/partition_species.py index 21a57197ccd..dea38378a7a 100644 --- a/src/sage/combinat/species/partition_species.py +++ b/src/sage/combinat/species/partition_species.py @@ -141,7 +141,7 @@ def __classcall__(cls, *args, **kwds): sage: P = species.PartitionSpecies(); P Partition species - """ + """ return super().__classcall__(cls, *args, **kwds) def __init__(self, min=None, max=None, weight=None):