Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Merge branch 'u/jmantysalo/add__standard_example__poset' of trac.sage…
Browse files Browse the repository at this point in the history
…math.org:sage into u/jmantysalo/add__standard_example__poset
  • Loading branch information
Travis Scrimshaw committed Jan 23, 2016
2 parents 1961f94 + acd7169 commit c2c7fa5
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions src/sage/combinat/posets/poset_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
:meth:`~Posets.RestrictedIntegerPartitions` | Return the poset of integer partitions of `n`, ordered by restricted refinement.
:meth:`~Posets.ShardPoset` | Return the shard intersection order.
:meth:`~Posets.SSTPoset` | Return the poset on semistandard tableaux of shape `s` and largest entry `f` that is ordered by componentwise comparison.
:meth:`~Posets.StandardExample` | Return the standard example of a poset with dimension 'n'.
:meth:`~Posets.SymmetricGroupBruhatIntervalPoset` | The poset of permutations with respect to Bruhat order.
:meth:`~Posets.SymmetricGroupBruhatOrderPoset` | The poset of permutations with respect to Bruhat order.
:meth:`~Posets.SymmetricGroupWeakOrderPoset` | The poset of permutations of `\{ 1, 2, \ldots, n \}` with respect to the weak order.
Expand Down Expand Up @@ -513,6 +514,53 @@ def tableaux_is_less_than(a,b):
E = SemistandardTableaux(s, max_entry=f)
return Poset((E, tableaux_is_less_than))

@staticmethod
def StandardExample(n, facade=None):
r"""
Return the partially ordered set on ``2n`` elements with
dimension ``n``.
INPUT:
- ``n`` - An integer `\ge 2`, dimension of the constructed poset.
- ``facade`` (boolean) -- whether to make the returned poset a
facade poset (see :mod:`sage.categories.facade_sets`). The
default behaviour is the same as the default behaviour of
the :func:`~sage.combinat.posets.posets.Poset` constructor).
OUTPUT:
A poset on `\{0,1,2,\ldots, 2n-1\}` whose defining relations are that
every `0\leq i < n` is less than every `n\leq j <2n`, except when
`i+n=j`. This is the so-called "standard example" of a poset with
dimension `n`.
EXAMPLES::
sage: A = Posets.StandardExample(3); A
Finite poset containing 6 elements
sage: A.dimension()
3
TESTS::
sage: A = Posets.StandardExample(10); A
Finite poset containing 20 elements
sage: len(A.cover_relations())
90
sage: P = Posets.StandardExample(5, facade=False)
sage: P(4) < P(3), P(4) > P(3)
(False, False)
"""
try:
n = Integer(n)
except TypeError:
raise TypeError("dimension must be an integer, not {0}".format(n))
if n < 2:
raise ValueError("dimension must be at least 2, not {0}".format(n))
return Poset( (range(2*n), [[i, j+n] for i in range(n) for j in range(n) if i != j]), facade = facade )

@staticmethod
def SymmetricGroupBruhatOrderPoset(n):
"""
Expand Down

0 comments on commit c2c7fa5

Please sign in to comment.