def __init__(self, parent, vecpar): """ Initialize ``self``. EXAMPLES:: sage: elt = VectorPartition([[3, 2, 1], [2, 2, 1]]) sage: TestSuite(elt).run() """ CombinatorialElement.__init__(self, parent, sorted(vecpar))
def __init__(self, parent, t): r""" Initialize a composition tableau. TESTS:: sage: t = CompositionTableaux()([[1],[2,2]]) sage: s = CompositionTableaux(3)([[1],[2,2]]) sage: s==t True sage: t.parent() Composition Tableaux sage: s.parent() Composition Tableaux of size 3 and maximum entry 3 sage: r = CompositionTableaux()(s) sage: r.parent() Composition Tableaux """ if isinstance(t, CompositionTableau): CombinatorialElement.__init__(self, parent, t._list) return # CombinatorialObject verifies that t is a list # We must verify t is a list of lists if not all(isinstance(row, list) for row in t): raise ValueError("A composition tableau must be a list of lists.") if not [len(_) for _ in t] in Compositions(): raise ValueError( "A composition tableau must be a list of non-empty lists.") # Verify rows weakly decrease from left to right for row in t: if any(row[i] < row[i + 1] for i in range(len(row) - 1)): raise ValueError( "Rows must weakly decrease from left to right.") # Verify leftmost column strictly increases from top to bottom first_col = [row[0] for row in t if t != [[]]] if any(first_col[i] >= first_col[i + 1] for i in range(len(t) - 1)): raise ValueError( "Leftmost column must strictly increase from top to bottom.") # Verify triple condition l = len(t) m = max([len(_) for _ in t] + [0]) TT = [row + [0] * (m - len(row)) for row in t] for i in range(l): for j in range(i + 1, l): for k in range(1, m): if TT[j][k] != 0 and TT[j][k] >= TT[i][k] and TT[j][ k] <= TT[i][k - 1]: raise ValueError("Triple condition must be satisfied.") CombinatorialElement.__init__(self, parent, t)
def __init__(self, parent, t): r""" Initialize a composition tableau. TESTS:: sage: t = CompositionTableaux()([[1],[2,2]]) sage: s = CompositionTableaux(3)([[1],[2,2]]) sage: s==t True sage: t.parent() Composition Tableaux sage: s.parent() Composition Tableaux of size 3 and maximum entry 3 sage: r = CompositionTableaux()(s) sage: r.parent() Composition Tableaux """ if isinstance(t, CompositionTableau): CombinatorialElement.__init__(self, parent, t._list) return # CombinatorialObject verifies that t is a list # We must verify t is a list of lists if not all(isinstance(row, list) for row in t): raise ValueError("A composition tableau must be a list of lists.") if not [len(_) for _ in t] in Compositions(): raise ValueError("A composition tableau must be a list of non-empty lists.") # Verify rows weakly decrease from left to right for row in t: if any(row[i] < row[i+1] for i in range(len(row)-1)): raise ValueError("Rows must weakly decrease from left to right.") # Verify leftmost column strictly increases from top to bottom first_col = [row[0] for row in t if t!=[[]]] if any(first_col[i] >= first_col[i+1] for i in range(len(t)-1)): raise ValueError("Leftmost column must strictly increase from top to bottom.") # Verify triple condition l = len(t) m = max([len(_) for _ in t]+[0]) TT = [row+[0]*(m-len(row)) for row in t] for i in range(l): for j in range(i+1,l): for k in range(1,m): if TT[j][k] != 0 and TT[j][k] >= TT[i][k] and TT[j][k] <= TT[i][k-1]: raise ValueError("Triple condition must be satisfied.") CombinatorialElement.__init__(self, parent, t)
def __init__(self,parent,data): r""" EXAMPLES:: sage: Y = crystals.infinity.GeneralizedYoungWalls(2) sage: mg = Y.module_generators[0] sage: TestSuite(mg).run() """ i = len(data)-1 while i >= 0 and len(data[i]) == 0: data.pop() i -= 1 self.rows = len(data) if data == []: self.cols = 0 else: self.cols = max([len(r) for r in data]) self.data = data CombinatorialElement.__init__(self, parent, data)
def __init__(self, parent, data): r""" EXAMPLES:: sage: Y = crystals.infinity.GeneralizedYoungWalls(2) sage: mg = Y.module_generators[0] sage: TestSuite(mg).run() """ i = len(data) - 1 while i >= 0 and len(data[i]) == 0: data.pop() i -= 1 self.rows = len(data) if data == []: self.cols = 0 else: self.cols = max([len(r) for r in data]) self.data = data CombinatorialElement.__init__(self, parent, data)
def __init__(self, parent, core): """ TESTS:: sage: C = Cores(4,3) sage: c = C([2,1]); c [2, 1] sage: type(c) <class 'sage.combinat.core.Cores_length_with_category.element_class'> sage: c.parent() 4-Cores of length 3 sage: TestSuite(c).run() sage: C = Cores(3,3) sage: C([2,1]) Traceback (most recent call last): ... ValueError: [2, 1] is not a 3-core """ k = parent.k part = Partition(core) if not part.is_core(k): raise ValueError("%s is not a %s-core" % (part, k)) CombinatorialElement.__init__(self, parent, core)
def __init__(self, parent, core): """ TESTS:: sage: C = Cores(4,3) sage: c = C([2,1]); c [2, 1] sage: type(c) <class 'sage.combinat.core.Cores_length_with_category.element_class'> sage: c.parent() 4-Cores of length 3 sage: TestSuite(c).run() sage: C = Cores(3,3) sage: C([2,1]) Traceback (most recent call last): ... ValueError: [2, 1] is not a 3-core """ k = parent.k part = Partition(core) if not part.is_core(k): raise ValueError("%s is not a %s-core"%(part, k)) CombinatorialElement.__init__(self, parent, core)