Returns the combinatorial class of alternating sign matrices of size n.
EXAMPLES:
sage: a2 = AlternatingSignMatrices(2); a2
Alternating sign matrices of size 2
sage: for a in a2: print a, "-\n"
[0 1]
[1 0]
-
[1 0]
[0 1]
-
TESTS:
sage: a2 = AlternatingSignMatrices(2); a2
Alternating sign matrices of size 2
sage: a2 == loads(dumps(a2))
True
TESTS:
sage: AlternatingSignMatrices(0).list() # indirect doctest
[[]]
sage: AlternatingSignMatrices(1).list() # indirect doctest
[[1]]
sage: map(list, AlternatingSignMatrices(2).list()) # indirect doctest
[[(0, 1), (1, 0)], [(1, 0), (0, 1)]]
sage: map(list, AlternatingSignMatrices(3).list()) # indirect doctest
[[(0, 0, 1), (0, 1, 0), (1, 0, 0)],
[(0, 1, 0), (0, 0, 1), (1, 0, 0)],
[(0, 0, 1), (1, 0, 0), (0, 1, 0)],
[(0, 1, 0), (1, -1, 1), (0, 1, 0)],
[(0, 1, 0), (1, 0, 0), (0, 0, 1)],
[(1, 0, 0), (0, 0, 1), (0, 1, 0)],
[(1, 0, 0), (0, 1, 0), (0, 0, 1)]]
TESTS:
sage: repr(AlternatingSignMatrices(2))
'Alternating sign matrices of size 2'
TESTS:
sage: [ AlternatingSignMatrices(n).cardinality() for n in range(0, 11)]
[1, 1, 2, 7, 42, 429, 7436, 218348, 10850216, 911835460, 129534272700]
sage: asms = [ AlternatingSignMatrices(n) for n in range(6) ]
sage: all( [ asm.cardinality() == len(asm.list()) for asm in asms] )
True
Returns the combinatorial class of contre tableaux of size n.
EXAMPLES:
sage: ct4 = ContreTableaux(4); ct4
Contre tableaux of size 4
sage: ct4.cardinality()
42
sage: ct4.first()
[[1, 2, 3, 4], [1, 2, 3], [1, 2], [1]]
sage: ct4.last()
[[1, 2, 3, 4], [2, 3, 4], [3, 4], [4]]
sage: ct4.random_element()
[[1, 2, 3, 4], [1, 2, 3], [1, 3], [3]]
TESTS:
sage: ct2 = ContreTableaux(2); ct2
Contre tableaux of size 2
sage: ct2 == loads(dumps(ct2))
True
TESTS:
sage: ContreTableaux(0).list() #indirect test
[[]]
sage: ContreTableaux(1).list() #indirect test
[[[1]]]
sage: ContreTableaux(2).list() #indirect test
[[[1, 2], [1]], [[1, 2], [2]]]
sage: ContreTableaux(3).list() #indirect test
[[[1, 2, 3], [1, 2], [1]],
[[1, 2, 3], [1, 2], [2]],
[[1, 2, 3], [1, 3], [1]],
[[1, 2, 3], [1, 3], [2]],
[[1, 2, 3], [1, 3], [3]],
[[1, 2, 3], [2, 3], [2]],
[[1, 2, 3], [2, 3], [3]]]
TESTS:
sage: repr(ContreTableaux(2))
'Contre tableaux of size 2'
TESTS:
sage: c = ContreTableaux(2)
sage: list(c._iterator_rec(0))
[[]]
sage: list(c._iterator_rec(1))
[[[1, 2]]]
sage: list(c._iterator_rec(2))
[[[1, 2], [1]], [[1, 2], [2]]]
TESTS:
sage: [ ContreTableaux(n).cardinality() for n in range(0, 11)]
[1, 1, 2, 7, 42, 429, 7436, 218348, 10850216, 911835460, 129534272700]
Returns the combinatorial class of truncated staircases of size n with last column last_column.
EXAMPLES:
sage: t4 = TruncatedStaircases(4, [2,3]); t4
Truncated staircases of size 4 with last column [2, 3]
sage: t4.cardinality()
4
sage: t4.first()
[[4, 3, 2, 1], [3, 2, 1], [3, 2]]
sage: t4.list()
[[[4, 3, 2, 1], [3, 2, 1], [3, 2]], [[4, 3, 2, 1], [4, 2, 1], [3, 2]], [[4, 3, 2, 1], [4, 3, 1], [3, 2]], [[4, 3, 2, 1], [4, 3, 2], [3, 2]]]
TESTS:
sage: t4 = TruncatedStaircases(4, [2,3]); t4
Truncated staircases of size 4 with last column [2, 3]
sage: t4 == loads(dumps(t4))
True
EXAMPLES::
sage: TruncatedStaircases(4, [2,3]).list() #indirect test
[[[4, 3, 2, 1], [3, 2, 1], [3, 2]], [[4, 3, 2, 1], [4, 2, 1], [3, 2]], [[4, 3, 2, 1], [4, 3, 1], [3, 2]], [[4, 3, 2, 1], [4, 3, 2], [3, 2]]]
TESTS:
sage: repr(TruncatedStaircases(4, [2,3]))
'Truncated staircases of size 4 with last column [2, 3]'
TESTS:
sage: t = TruncatedStaircases(3, [2,3])
sage: list(t._iterator_rec(1))
[]
sage: list(t._iterator_rec(2))
[[[2, 3]]]
sage: list(t._iterator_rec(3))
[[[1, 2, 3], [2, 3]]]
Returns a generator for all columns of height height properly filled from row 1 to i
TESTS:
sage: import sage.combinat.alternating_sign_matrix as asm
sage: list(asm._next_column_iterator([1], 0))
[[]]
sage: list(asm._next_column_iterator([1,5],1))
[[1], [2], [3], [4], [5]]
sage: list(asm._next_column_iterator([1,4,5],2))
[[1, 4], [1, 5], [2, 4], [2, 5], [3, 4], [3, 5], [4, 5]]
TESTS:
sage: import sage.combinat.alternating_sign_matrix as asm
sage: list(asm._previous_column_iterator([2,3], 3, 4))
[[1, 2, 3], [1, 2, 4], [1, 3, 4], [2, 3, 4]]
Returns an alternating sign matrix from a contretableaux.
TESTS:
sage: import sage.combinat.alternating_sign_matrix as asm
sage: asm.from_contre_tableau([[1, 2, 3], [1, 2], [1]])
[0 0 1]
[0 1 0]
[1 0 0]
sage: asm.from_contre_tableau([[1, 2, 3], [2, 3], [3]])
[1 0 0]
[0 1 0]
[0 0 1]