Add `Permutation(Group).permute_index` and refactor group-matrix `@`
Created by: attila-i-szabo
This PR adds the permute_index
apply_to_id
method to both Permutation
and PermutationGroup
. They take an array of integers as input and return what they are mapped to by the permutation (or all permutations along the 0th axis). This is useful for generating all symmetry-equivalent configurations of a set of sites. For example, you can get every square of a (PBC) square lattice as
graph = nk.graph.Square(6)
square = [0,1,7,6] # this is a square
squares = graph.translation_group().permute_index(square)
Incidentally, I also implemented the application of whole PermutationGroup
s and PointGroup
s to an Array
more efficiently. Now, these are also added to the dispatch system around @
. Everything works the same way as it used to, except now group @ array
is valid and equivalent to group(array)
.