Partition Species

sage.combinat.species.partition_species.PartitionSpecies(*args, **kwds)

Create a cached version of a function, which only recomputes values it hasn’t already computed. Synonyme: cached_function

INPUT:

  • f – a function
  • name (optional string) – name that the cached version of f should be provided with.

If f is a function, do either g = CachedFunction(f) or g = cached_function(f) to make a cached version of f, or put @cached_function right before the definition of f (i.e., use Python decorators):

@cached_function
def f(...):
    ....

The inputs to the function must be hashable.

EXAMPLES:

sage: @cached_function
... def mul(x, y=2):
...     return x*y
...
sage: mul(3)
6

We demonstrate that the result is cached, and that, moreover, the cache takes into account the various ways of providing default arguments:

sage: mul(3) is mul(3,2)
True
sage: mul(3,y=2) is mul(3,2)
True

The user can clear the cache:

sage: a = mul(4)
sage: mul.clear_cache()
sage: a is mul(4)
False

It is also possible to explicitly override the cache with a different value:

sage: mul.set_cache('foo',5)
sage: mul(5,2)
'foo'
class sage.combinat.species.partition_species.PartitionSpeciesStructure(parent, labels, list)

Bases: sage.combinat.species.structure.GenericSpeciesStructure

EXAMPLES:

sage: from sage.combinat.species.partition_species import PartitionSpeciesStructure
sage: P = species.PartitionSpecies()
sage: s = PartitionSpeciesStructure(P, ['a','b','c'], [[1,2],[3]]); s
{{'a', 'b'}, {'c'}}
sage: s == loads(dumps(s))
True
automorphism_group()

Returns the group of permutations whose action on this set partition leave it fixed.

EXAMPLES:

sage: p = PermutationGroupElement((2,3))
sage: from sage.combinat.species.partition_species import PartitionSpeciesStructure
sage: a = PartitionSpeciesStructure(None, [2,3,4], [[1,2],[3]]); a
{{2, 3}, {4}}
sage: a.automorphism_group()
Permutation Group with generators [(1,2)]
canonical_label()

EXAMPLES:

sage: P = species.PartitionSpecies()
sage: S = P.structures(["a", "b", "c"])
sage: [s.canonical_label() for s in S]
[{{'a', 'b', 'c'}},
 {{'a', 'b'}, {'c'}},
 {{'a', 'b'}, {'c'}},
 {{'a', 'b'}, {'c'}},
 {{'a'}, {'b'}, {'c'}}]
change_labels(labels)

EXAMPLES:

sage: p = PermutationGroupElement((2,3))
sage: from sage.combinat.species.partition_species import PartitionSpeciesStructure
sage: a = PartitionSpeciesStructure(None, [2,3,4], [[1,2],[3]]); a
{{2, 3}, {4}}
sage: a.change_labels([1,2,3])
{{1, 2}, {3}}
transport(perm)

Returns the transport of this set partition along the permutation perm. For set partitions, this is the direct product of the automorphism groups for each of the blocks.

EXAMPLES:

sage: p = PermutationGroupElement((2,3))
sage: from sage.combinat.species.partition_species import PartitionSpeciesStructure
sage: a = PartitionSpeciesStructure(None, [2,3,4], [[1,2],[3]]); a
{{2, 3}, {4}}
sage: a.transport(p)
{{2, 4}, {3}}
class sage.combinat.species.partition_species.PartitionSpecies_class(min=None, max=None, weight=None)

Bases: sage.combinat.species.species.GenericCombinatorialSpecies

EXAMPLES:

sage: P = species.PartitionSpecies()
sage: P._check()
True
sage: P == loads(dumps(P))
True

Previous topic

Cycle Species

Next topic

Permutation species

This Page