Iterators

Collection of iterators.

EXAMPLES:

sage: from msinvar.iterators import *
sage: list(IntegerVectors_iterator([2,2]))
[[1, 0], [2, 0], [0, 1], [1, 1], [2, 1], [0, 2], [1, 2], [2, 2]]
sage: M=[[1,2,1],[3,1,1]]
sage: list(Multiplicities_iterator(M,[3,4]))
[[1, 0, 0],
 [0, 1, 0],
 [1, 1, 0],
 [0, 0, 1],
 [1, 0, 1],
 [0, 1, 1],
 [0, 0, 2],
 [0, 0, 3]]
msinvar.iterators.IntegerVectors_iterator(vect)[source]

Iterator over integer vectors 0 < a <= vect

It is more efficient than sage.combinat.vector_partition.IntegerVectorsIterator().

vect – a list of integers.

EXAMPLES:

sage: from msinvar.iterators import *
sage: list(IntegerVectors_iterator([2,2]))
[[1, 0], [2, 0], [0, 1], [1, 1], [2, 1], [0, 2], [1, 2], [2, 2]]
msinvar.iterators.Multiplicities_iterator(M, b)[source]

Iterator over integer vectors a>0 such that M*a<=b, where M is a matrix and b is a vector.

  • M – Matrix of size m x n

  • b – Vector of size m

msinvar.iterators.OrderedMultiPartitionsLE_iterator(vect)[source]

Iterator over collections of vectors (a_1,..,a_k) such that a_1+..+a_k <= vect and a_i>0.

msinvar.iterators.OrderedMultiPartitions_iterator(vect)[source]

Iterator over collections of vectors (a_1,…,a_k) such that a_1+…+a_k = vect and a_i>0.

msinvar.iterators.OrderedPartitionsLE_iterator(n)[source]

Iterator over collections of positive numbers (a_1,..,a_k) such that a_1+..+a_k <= n.

msinvar.iterators.OrderedPartitions_iterator(n)[source]

Iterator over collections of positive numbers (a_1,…,a_k) such that a_1+…+a_k = n.

msinvar.iterators.MultiPartitionsLE_iterator(vect, bound=None)[source]

Iterator over collections of vectors bound>=a_1 >=…>=a_k>0 such that a_1+…+a_k <= vect.

msinvar.iterators.MultiPartitions_iterator(vect, bound=None)[source]

Iterator over collections of vectors bound>=a_1>=…>=a_k>0 such that a_1+…+a_k = vect.

msinvar.iterators.Subsets_iterator(n)[source]

Iterator over non-empty subsets of the set {0,..,n-1}.

msinvar.iterators.ListPartitions_iterator(l)[source]

Iterator over collections of nonempty disjoint lists (l1,..,lk) such that l1+…+lk= l.

msinvar.iterators.UnorderedMultiPartitions_iterator(vect, bound=None)[source]

Iterator over sets of vectors (a_1,…,a_k) such that a_1+…+a_k = vect and a_i>0. We order vectors lexicographically.