Macaulay2 » Documentation
Packages » Chordal :: nextOrderedPartition
next | previous | forward | backward | up | index | toc

nextOrderedPartition -- iterates over ordered partitions of a number

Synopsis

Description

Given an integer $n$ and lists $L_1,\ldots,L_k$ of distinct nonnegative integers, this method iterates over all tuples $(l_1,\ldots,l_k)$ such that $\sum_i l_i = n$ and $l_i\in L_i$. The tuples are produced one at a time.

Returns "null" if none.

i1 : L = {{0,1},{0,1,2},{2,3}};
i2 : P = nextOrderedPartition (5,L)

o2 = {0, 2, 3}

o2 : List
i3 : P = nextOrderedPartition (P,5,L)

o3 = {1, 1, 3}

o3 : List
i4 : P = nextOrderedPartition (P,5,L)

o4 = {1, 2, 2}

o4 : List
i5 : assert(nextOrderedPartition (P,5,L) === null)

      

Ways to use nextOrderedPartition :

For the programmer

The object nextOrderedPartition is a method function.