Vector Partitions¶
AUTHORS:
- Amritanshu Prasad (2013): Initial version
-
sage.combinat.vector_partition.
IntegerVectorsIterator
(vect, min=None)¶ Return an iterator over the list of integer vectors which are componentwise less than or equal to
vect
, and lexicographically greater than or equal tomin
.INPUT:
vect
– A list of non-negative integersmin
– A list of non-negative integers dominated elementwise byvect
OUTPUT:
A list in lexicographic order of all integer vectors (as lists) which are dominated elementwise by
vect
and are greater than or equal tomin
in lexicographic order.EXAMPLES:
sage: from sage.combinat.vector_partition import IntegerVectorsIterator sage: list(IntegerVectorsIterator([1, 1])) [[0, 0], [0, 1], [1, 0], [1, 1]] sage: list(IntegerVectorsIterator([1, 1], min = [1, 0])) [[1, 0], [1, 1]]
-
sage.combinat.vector_partition.
VectorPartition
¶ A vector partition is a multiset of integer vectors.
-
sage.combinat.vector_partition.
VectorPartitions
¶ Class of all vector partitions of
vec
with all parts greater than or equal tomin
in lexicographic order.A vector partition of
vec
is a list of vectors with non-negative integer entries whose sum isvec
.INPUT:
vec
– a list of non-negative integers.
EXAMPLES:
If
min
is not specified, then the class of all vector partitions ofvec
is created:sage: VP = VectorPartitions([2, 2]) sage: for vecpar in VP: ....: print(vecpar) [[0, 1], [0, 1], [1, 0], [1, 0]] [[0, 1], [0, 1], [2, 0]] [[0, 1], [1, 0], [1, 1]] [[0, 1], [2, 1]] [[0, 2], [1, 0], [1, 0]] [[0, 2], [2, 0]] [[1, 0], [1, 2]] [[1, 1], [1, 1]] [[2, 2]]
If
min
is specified, then the class consists of only those vector partitions whose parts are all greater than or equal tomin
in lexicographic order:sage: VP = VectorPartitions([2, 2], min = [1, 0]) sage: for vecpar in VP: ....: print(vecpar) [[1, 0], [1, 2]] [[1, 1], [1, 1]] [[2, 2]]
-
sage.combinat.vector_partition.
find_min
(vect)¶ Return a string of
0
’s with one1
at the location where the list vect has its last entry which is not equal to0
.INPUT:
vec
– A list of integers
OUTPUT:
A list of the same length with
0
’s everywhere, except for a1
at the last position wherevec
has an entry not equal to0
.EXAMPLES:
sage: from sage.combinat.vector_partition import find_min sage: find_min([2, 1]) [0, 1] sage: find_min([2, 1, 0]) [0, 1, 0]