def cardinality(self): """ EXAMPLES:: sage: SemistandardSkewTableaux([[2,1],[]]).cardinality() 8 """ count = 0 for mu in IntegerVectors(self.p.size(), self.p.size()): count += SemistandardSkewTableaux_pmu(self.p, mu).cardinality() return count
def __iter__(self): """ EXAMPLES:: sage: Combinations(['a','a','b'],2).list() # indirect doctest [['a', 'a'], ['a', 'b']] """ items = map(self.mset.index, self.mset) indices = uniq(sorted(items)) counts = [0] * len(indices) for i in items: counts[indices.index(i)] += 1 for iv in IntegerVectors(self.k, len(indices), outer=counts): yield sum([[self.mset[indices[i]]] * iv[i] for i in range(len(indices))], [])
def __iter__(self): """ TESTS:: sage: LyndonWords(3,3).list() # indirect doctest [word: 112, word: 113, word: 122, word: 123, word: 132, word: 133, word: 223, word: 233] """ for c in IntegerVectors(self.k, self.n): cf = [x for x in c if x != 0] nonzero_indices = [] for i in range(len(c)): if c[i] != 0: nonzero_indices.append(i) for lw in LyndonWords_evaluation(cf): yield LyndonWord(map(lambda x: nonzero_indices[x-1]+1, lw), check=False)
def __iter__(self): """ EXAMPLES:: sage: SemistandardSkewTableaux([[2,1],[]]).list() #indirect test [[[1, 1], [2]], [[1, 1], [3]], [[1, 2], [2]], [[1, 3], [2]], [[1, 2], [3]], [[1, 3], [3]], [[2, 2], [3]], [[2, 3], [3]]] """ for mu in IntegerVectors(self.p.size(), self.p.size()): for ssst in SemistandardSkewTableaux_shape_weight(self.p, mu): yield ssst
def __iter__(self): """ TESTS:: sage: LyndonWords(3,3).list() # indirect doctest [word: 112, word: 113, word: 122, word: 123, word: 132, word: 133, word: 223, word: 233] """ for c in IntegerVectors(self._k, self._n): cf = [] nonzero_indices = [] for i, x in enumerate(c): if x: nonzero_indices.append(i) cf.append(x) for lw in LyndonWords_evaluation(Composition(cf)): yield self._words([nonzero_indices[x - 1] + 1 for x in lw], check=False)