utils¶
Set of auxiliary functions used across the project.
- utils.get_partitions(n: int) list[tuple[int]] ¶
Returns a list of all partitions of n.
- Parameters:
n (int) – Integer to partition
- Returns:
List of all partitions of n.
- Return type:
list[tuple[int]]
- utils.majorize(mu: tuple[int], ell: tuple[int], eq=True) bool ¶
Determines if lambda >= Mu in majorization order
- Parameters:
mu (tuple[int]) – Partition as a list of positive integers in nonincreasing order.
ell (tuple[int]) – Partition as a list of positive integers in nonincreasing order.
eq – Flag for requiring that Mu and Lambda are partitions of the same number
- Returns:
True if Lambda >= Mu in majorization order, False otherwise.
- Return type:
bool
- utils.partitions(n: int, minimum_partition_value: int = 1)¶
Returns a generator that yields all partitions of n.
Source: https://stackoverflow.com/questions/10035752/elegant-python-code-for-integer-partitioning
- Parameters:
n (int) – Integer to partition
minimum_partition_value (int, optional) – Minimum partition value. Defaults to 1.
- utils.perm_module_d(mu: tuple[int]) int ¶
Returns the dimension of the permutation module of label Mu
- Parameters:
Mu (tuple[int]) – Partition as a list of positive integers in nonincreasing order that sum up to n.
- Returns:
Dimension of the permutation module of label Mu
- Return type:
int