PermutationStateIndexer

A sophisticated indexer that takes a state dimension and provides indices based on the shortlex ordering, where ordering is defined first by # of quanta of excitation, then by which partitioning of the #quanta, it represents, and finally by which permutation of that paritioning it is. Is likely about as stable as an indexer can be expected to be over large numbers of states. Unlikely to exhaust the max integers available for most systems.

 

__init__(self, ndim): 

 

to_state(self, serializer=None): 

 

@classmethod
from_state(cls, data, serializer=None): 

 

to_indices(self, states): 

Finds the appropriate integer partitioning for each state

  • states: np.ndarray

    2D array of states as excitations

  • :returns: _

 

from_indices(self, indices, check=False): 

Inverts the index calculation. First determines what number of quanta the index corresponds to, then which integer partition, and finally just loops through the unique permutations of the partition to get the right one. This is not assured to be a fast process in any way.

  • indices: Iterable[int]
  • :returns: _

Feedback

Examples

Templates

Documentation