Skip to content

Permutation group product table

Created by: attila-i-szabo

This PR changes PermutationGroup.product_table to make it more memory-friendly.

The upstream version calculates the permutations corresponding to every g^-1 h in one numpy-array-indexing command. This generates a matrix of N_site * N_symm^2 integers, which quickly gets obscenely large, leading to memory errors. (As a modest example, a 16×16 square lattice has N_site=256 and N_symm=2048, leading to a size-1,073,741,824 array). It's even worse as the array is then recreated as a list of HashableArrays.

Instead, I split this calculation by rows of the product table. This makes the code quite transparent, memory-friendly, and I don't expect it to introduce a large time overhead. (There is a new loop over the rows, but we've already had loops that cycle through every entry of the product table, so I'm not too worried. In fact, one of those is gone now.) It has already been a very slow method, but there doesn't seem to be a way to make it significantly more performant.

The output of the function doesn't change.

Merge request reports