Module: sage.combinat.alternating_sign_matrix
Alternating Sign Matrices
Module-level Functions
n) |
Returns the combinatorial class of alternating sign matrices of size n.
sage: a2 = AlternatingSignMatrices(2); a2 Alternating sign matrices of size 2 sage: for a in a2: print a, "- " [0 1] [1 0] - [1 0] [0 1] -
n) |
Returns the combinatorial class of contre tableaux of size n.
sage: ct4 = ContreTableaux(4); ct4 Contre tableaux of size 4 sage: ct4.count() 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]]
n, last_column) |
Returns the combinatorial class of truncated staircases of size n with last column last_column.
sage: t4 = TruncatedStaircases(4, [2,3]); t4 Truncated staircases of size 4 with last column [2, 3] sage: t4.count() 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]]]
comps) |
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]
Class: AlternatingSignMatrices_n
self, n) |
TESTS:
sage: a2 = AlternatingSignMatrices(2); a2 Alternating sign matrices of size 2 sage: a2 == loads(dumps(a2)) True
Functions: count,
iterator
self) |
TESTS:
sage: [ AlternatingSignMatrices(n).count() 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.count() == len(asm.list()) for asm in asms] ) True
self) |
TESTS:
sage: AlternatingSignMatrices(0).list() [[]] sage: AlternatingSignMatrices(1).list() [[1]] sage: map(list, AlternatingSignMatrices(2).list()) [[(0, 1), (1, 0)], [(1, 0), (0, 1)]] sage: map(list, AlternatingSignMatrices(3).list()) [[(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)]]
Special Functions: __init__,
__repr__
self) |
TESTS:
sage: repr(AlternatingSignMatrices(2)) 'Alternating sign matrices of size 2'
Class: ContreTableaux_n
self, n) |
TESTS:
sage: ct2 = ContreTableaux(2); ct2 Contre tableaux of size 2 sage: ct2 == loads(dumps(ct2)) True
Functions: count,
iterator
self) |
TESTS:
sage: [ ContreTableaux(n).count() for n in range(0, 11)] [1, 1, 2, 7, 42, 429, 7436, 218348, 10850216, 911835460, 129534272700]
self) |
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]]]
Special Functions: __init__,
__repr__,
_iterator_rec
self) |
TESTS:
sage: repr(ContreTableaux(2)) 'Contre tableaux of size 2'
self, i) |
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]]]
Class: TruncatedStaircases_nlastcolumn
self, n, last_column) |
TESTS:
sage: t4 = TruncatedStaircases(4, [2,3]); t4 Truncated staircases of size 4 with last column [2, 3] sage: t4 == loads(dumps(t4)) True
Functions: iterator
self) |
:
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]]]
Special Functions: __init__,
__repr__,
_iterator_rec
self) |
TESTS:
sage: repr(TruncatedStaircases(4, [2,3])) 'Truncated staircases of size 4 with last column [2, 3]'
self, i) |
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]]]