partperm.spad line 1 [edit on github]
PartitionsAndPermutations contains functions for generating streams of integer partitions, and streams of sequences of integers composed from a multi-set.
conjugate(pt)
is the conjugate of the partition pt
.
conjugates(lp)
is the stream of conjugates of a stream of partitions lp
.
distinct_partitions(n)
is the stream of all partitions of n
into distinct numbers.
distinct_partitions(p, l, n)
is the stream of partitions of n
into distinct numbers whose number of parts is no greater than p
and whose largest part is no greater than l
.
odd_partitions(n)
is the stream of all partitions of n
into odd numbers.
odd_partitions(p, l, n)
is the stream of partitions of n
into odd numbers whose number of parts is no greater than p
and whose largest part is no greater than l
.
partitions(n)
is the stream of all partitions of n
.
partitions(p, l)
is the stream of all partitions whose number of parts and largest part are no greater than p
and l
.
partitions(p, l, n)
is the stream of partitions of n
whose number of parts is no greater than p
and whose largest part is no greater than l
.
permutations(n)
is the stream of permutations formed from 1, 2, 3, ..., n
.
sequences([l0, l1, l2, .., ln])
is the set of all sequences formed from l0
0's
, l1
1's
, l2
2's
, ..., ln
n
's
.
sequences(l1, l2)
is the stream of all sequences that can be composed from the multiset defined from two lists of integers l1
and l2
. For example, the pair ([1, 2, 4], [2, 3, 5])
represents multi-set with 1 2
, 2 3
's
, and 4 5
's
.
shuffle(l1, l2)
forms the stream of all shuffles of l1
and l2
, i.e. all sequences that can be formed from merging l1
and l2
.
shufflein(l, st)
maps shuffle(l
, u
) on to all members u
of st, concatenating the results.