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 andb
is a vector.M
– Matrix of size m x nb
– 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}.