本文整理汇总了Python中species.GenericCombinatorialSpecies类的典型用法代码示例。如果您正苦于以下问题:Python GenericCombinatorialSpecies类的具体用法?Python GenericCombinatorialSpecies怎么用?Python GenericCombinatorialSpecies使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GenericCombinatorialSpecies类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, F, G, min=None, max=None, weight=None):
"""
EXAMPLES::
sage: X = species.SingletonSpecies()
sage: A = X*X
sage: A.generating_series().coefficients(4)
[0, 0, 1, 0]
sage: P = species.PermutationSpecies()
sage: F = P * P; F
Product of (Permutation species) and (Permutation species)
sage: F == loads(dumps(F))
True
sage: F._check()
True
TESTS::
sage: X = species.SingletonSpecies()
sage: X*X is X*X
True
"""
self._F = F
self._G = G
self._state_info = [F, G]
GenericCombinatorialSpecies.__init__(self, min=None, max=None, weight=weight)
示例2: __init__
def __init__(self, min=None, max=None, weight=None):
"""
Returns the species of cycles.
EXAMPLES::
sage: C = species.CycleSpecies(); C
Cyclic permutation species
sage: C.structures([1,2,3,4]).list()
[(1, 2, 3, 4),
(1, 2, 4, 3),
(1, 3, 2, 4),
(1, 3, 4, 2),
(1, 4, 2, 3),
(1, 4, 3, 2)]
TESTS: We check to verify that the caching of species is actually
working.
::
sage: species.CycleSpecies() is species.CycleSpecies()
True
sage: P = species.CycleSpecies()
sage: c = P.generating_series().coefficients(3)
sage: P._check()
True
sage: P == loads(dumps(P))
True
"""
GenericCombinatorialSpecies.__init__(self, min=min, max=max, weight=weight)
self._name = "Cyclic permutation species"
示例3: __init__
def __init__(self, F, G, min=None, max=None, weight=None):
"""
Returns the sum of two species.
EXAMPLES::
sage: S = species.PermutationSpecies()
sage: A = S+S
sage: A.generating_series().coefficients(5)
[2, 2, 2, 2, 2]
sage: P = species.PermutationSpecies()
sage: F = P + P
sage: F._check()
True
sage: F == loads(dumps(F))
True
TESTS::
sage: A = species.SingletonSpecies() + species.SingletonSpecies()
sage: B = species.SingletonSpecies() + species.SingletonSpecies()
sage: C = species.SingletonSpecies() + species.SingletonSpecies(min=2)
sage: A is B
True
sage: (A is C) or (A == C)
False
"""
self._F = F
self._G = G
self._state_info = [F, G]
GenericCombinatorialSpecies.__init__(self, min=None, max=None, weight=None)
示例4: __init__
def __init__(self, F, G, min=None, max=None, weight=None):
"""
Returns the composition of two species.
EXAMPLES::
sage: E = species.SetSpecies()
sage: C = species.CycleSpecies()
sage: S = E(C)
sage: S.generating_series().coefficients(5)
[1, 1, 1, 1, 1]
sage: E(C) is S
True
TESTS::
sage: E = species.SetSpecies(); C = species.CycleSpecies()
sage: L = E(C)
sage: c = L.generating_series().coefficients(3)
sage: L._check() #False due to isomorphism types not being implemented
False
sage: L == loads(dumps(L))
True
"""
self._F = F
self._G = G
self._name = "Composition of (%s) and (%s)"%(F, G)
self._state_info = [F, G]
GenericCombinatorialSpecies.__init__(self, min=None, max=None, weight=None)
示例5: __init__
def __init__(self, F, G, min=None, max=None, weight=None):
"""
Returns the functorial composition of two species.
EXAMPLES::
sage: E = species.SetSpecies()
sage: E2 = species.SetSpecies(size=2)
sage: WP = species.SubsetSpecies()
sage: P2 = E2*E
sage: G = WP.functorial_composition(P2)
sage: G.isotype_generating_series().coefficients(5)
[1, 1, 2, 4, 11]
sage: G = species.SimpleGraphSpecies()
sage: c = G.generating_series().coefficients(2)
sage: type(G)
<class 'sage.combinat.species.functorial_composition_species.FunctorialCompositionSpecies'>
sage: G == loads(dumps(G))
True
sage: G._check() #False due to isomorphism types not being implemented
False
"""
self._F = F
self._G = G
self._state_info = [F, G]
self._name = "Functorial composition of (%s) and (%s)"%(F, G)
GenericCombinatorialSpecies.__init__(self, min=None, max=None, weight=None)
示例6: __init__
def __init__(self, min=None, max=None, weight=None):
"""
EXAMPLES::
sage: P = species.PartitionSpecies()
sage: P._check()
True
sage: P == loads(dumps(P))
True
"""
GenericCombinatorialSpecies.__init__(self, min=min, max=max, weight=weight)
self._name = "Partition species"
示例7: __init__
def __init__(self, min=None, max=None, weight=None):
"""
EXAMPLES::
sage: L = species.LinearOrderSpecies()
sage: L._check()
True
sage: L == loads(dumps(L))
True
"""
GenericCombinatorialSpecies.__init__(self, min=min, max=max, weight=None)
self._name = "Linear order species"
示例8: __init__
def __init__(self, min=None, max=None, weight=None):
"""
EXAMPLES::
sage: P = species.PermutationSpecies()
sage: c = P.generating_series().coefficients(3)
sage: P._check()
True
sage: P == loads(dumps(P))
True
"""
GenericCombinatorialSpecies.__init__(self, min=min, max=max, weight=weight)
self._name = "Permutation species"
示例9: __init__
def __init__(self, min=None, max=None, weight=None):
"""
EXAMPLES::
sage: S = species.SubsetSpecies()
sage: c = S.generating_series().coefficients(3)
sage: S._check()
True
sage: S == loads(dumps(S))
True
"""
GenericCombinatorialSpecies.__init__(self, min=None, max=None, weight=None)
self._name = "Subset species"
示例10: __init__
def __init__(self, n, min=None, max=None, weight=None):
"""
EXAMPLES::
sage: F = species.CharacteristicSpecies(3)
sage: c = F.generating_series().coefficients(4)
sage: F._check()
True
sage: F == loads(dumps(F))
True
"""
self._n = n
self._name = "Characteristic species of order %s"%n
self._state_info = [n]
GenericCombinatorialSpecies.__init__(self, min=min, max=max, weight=weight)
示例11: __init__
def __init__(self, min=None, max=None, weight=None):
"""
Initializer for the empty species.
EXAMPLES::
sage: F = species.EmptySpecies()
sage: F._check()
True
sage: F == loads(dumps(F))
True
"""
# There is no structure at all, so we set min and max accordingly.
GenericCombinatorialSpecies.__init__(self, weight=weight)
self._name = "Empty species"
示例12: __init__
def __init__(self, F, G, min=None, max=None, weight=None):
"""
EXAMPLES::
sage: P = species.PermutationSpecies()
sage: F = P * P; F
Product of (Permutation species) and (Permutation species)
sage: F == loads(dumps(F))
True
sage: F._check()
True
"""
self._F = F
self._G = G
self._state_info = [F, G]
GenericCombinatorialSpecies.__init__(self, min=None, max=None, weight=weight)
示例13: __init__
def __init__(self, F, G, min=None, max=None, weight=None):
"""
EXAMPLES::
sage: G = species.SimpleGraphSpecies()
sage: c = G.generating_series().coefficients(2)
sage: type(G)
<class 'sage.combinat.species.functorial_composition_species.FunctorialCompositionSpecies_class'>
sage: G == loads(dumps(G))
True
sage: G._check() #False due to isomorphism types not being implemented
False
"""
self._F = F
self._G = G
self._state_info = [F, G]
self._name = "Functorial composition of (%s) and (%s)"%(F, G)
GenericCombinatorialSpecies.__init__(self, min=None, max=None, weight=None)
示例14: __init__
def __init__(self, min=None, max=None, weight=None):
"""
Returns the species of linear orders.
EXAMPLES::
sage: L = species.LinearOrderSpecies()
sage: L.generating_series().coefficients(5)
[1, 1, 1, 1, 1]
sage: L = species.LinearOrderSpecies()
sage: L._check()
True
sage: L == loads(dumps(L))
True
"""
GenericCombinatorialSpecies.__init__(self, min=min, max=max, weight=None)
self._name = "Linear order species"
示例15: __init__
def __init__(self, n, min=None, max=None, weight=None):
"""
Returns the characteristic species of order `n`.
This species has exactly one structure on a set of of size `n`
and no structures of on sets of any other size.
EXAMPLES::
sage: X = species.CharacteristicSpecies(1)
sage: X.structures([1]).list()
[1]
sage: X.structures([1,2]).list()
[]
sage: X.generating_series().coefficients(4)
[0, 1, 0, 0]
sage: X.isotype_generating_series().coefficients(4)
[0, 1, 0, 0]
sage: X.cycle_index_series().coefficients(4)
[0, p[1], 0, 0]
sage: F = species.CharacteristicSpecies(3)
sage: c = F.generating_series().coefficients(4)
sage: F._check()
True
sage: F == loads(dumps(F))
True
TESTS::
sage: S1 = species.CharacteristicSpecies(1)
sage: S2 = species.CharacteristicSpecies(1)
sage: S3 = species.CharacteristicSpecies(2)
sage: S4 = species.CharacteristicSpecies(2, weight=2)
sage: S1 is S2
True
sage: S1 == S3
False
"""
self._n = n
self._name = "Characteristic species of order %s"%n
self._state_info = [n]
GenericCombinatorialSpecies.__init__(self, min=min, max=max, weight=weight)