hafnian_#
Functions for Hafnian
Functions
Count the number of unique permutations of a list of numbers. |
|
|
Get the sub-matrix for hafnian calculation. |
|
Calculate the hafnian for symmetric matrix, using the eigenvalue-trace method. |
|
Calculate the batch hafnian. |
|
Generate all unique integer partitions of m using integers up to n. |
|
Get the coefficient of the polynomial. |
- count_unique_permutations(nums: list | ndarray) float64[source]#
Count the number of unique permutations of a list of numbers.
- get_submat_haf(a: Tensor, z: Tensor) Tensor[source]#
Get the sub-matrix for hafnian calculation.
See https://arxiv.org/abs/1805.12498 paragraph after Eq.(3.20)
- hafnian(matrix: Tensor, loop: bool = False) Tensor[source]#
Calculate the hafnian for symmetric matrix, using the eigenvalue-trace method.
See https://arxiv.org/abs/2108.01622 Eq.(B3)
- integer_partition(remaining: int, max_num: int) list[source]#
Generate all unique integer partitions of m using integers up to n.
- poly_lambda(submat: Tensor, int_partition: list, power: int, loop: bool = False) Tensor[source]#
Get the coefficient of the polynomial.
See https://arxiv.org/abs/1805.12498 Eq.(3.26) (noting that Eq.(3.26) contains a typo) and https://research-information.bris.ac.uk/ws/portalfiles/portal/329011096/thesis.pdf Eq.(3.80)