pygsti.tools.listtools.sorted_partitions

pygsti.tools.listtools.sorted_partitions#

sorted_partitions(n)#

Iterate over all sorted (decreasing) partitions of integer n.

A partition of n here is defined as a list of one or more non-zero integers which sum to n. Sorted partitions (those iterated over here) have their integers in decreasing order.

Parameters:

n (int) – The number to partition.