pygsti.tools.listtools.partition_into#
- partition_into(n, nbins)#
Iterate over all partitions of integer n into nbins bins.
Here, unlike in
partition(), a “partition” is allowed to contain zeros. For example, (4,1,0) is a valid partition of 5 using 3 bins. This function fixes the number of bins and iterates over all possible length- nbins partitions while allowing zeros. This is equivalent to iterating over all usual partitions of length at most nbins and inserting zeros into all possible places for partitions of length less than nbins.- Parameters:
n (int) – The number to partition.
nbins (int) – The fixed number of bins, equal to the length of all the partitions that are iterated over.