BasisStateSpace
Represents a subspace of states inside a representation basis. Useful largely to provide consistent, unambiguous representations of multiple states across the different representation-generating methods in the code base.
__init__(self, basis, states, full_basis=None, mode=None):
basis:RepresentationBasisstates:Iterable[int]mode:None | str | StateSpaceSpecwhether the states were supplied as indices or as excitations
check_indices(self):
to_state(self, serializer=None):
@classmethod
from_state(cls, data, serializer=None):
@property
indices(self):
Returns held indices
inds:Any:returns:_
@property
excitations(self):
Returns held excitations
inds:Any:returns:_
@classmethod
from_quanta(cls, basis, quants):
Returns states with quants quanta of excitation
using the basis basis
basis:RepresentationBasisquants:int | Iterable[int]set of integers
:returns:_B a s i s S t a t e S p a c e
@classmethod
states_in_windows(cls, freqs, windows: 'list[[int,int]]', max_state=None, min_quantas=None, max_quantas=None, initial_state=None, fixed_modes=None, basis=None):
@classmethod
states_under_freq_threshold(cls, freqs, thresh, min_freq=None, max_state=None, min_quanta=None, max_quanta=None, basis=None, fixed_modes=None):
get_mode(self):
infer_state_inds_type(self):
as_excitations(self):
Returns states as sets of excitations, rather than indices indo the basis functions. For 1D, this just means converting a list of states into tuples of length 1.
states:Any:returns:_
as_indices(self):
Returns states as sets of excitations, rather than indices indo the basis functions. For 1D, this just means converting a list of states into tuples of length 1.
states:Any:returns:_
to_single(self, track_excitations=True, track_indices=True):
Basically a no-op
:returns:_
is_unique(self):
Returns True if the number of states is equal to number of unique states
:returns:_
is_sorted(self, allow_indeterminate=True):
Checks and then sets a flag
:returns:_
take_unique(self, sort=False, track_excitations=True, track_indices=True):
Returns only the unique states, but preserves ordering and all of that unless explicitly allowed not to
:returns:_
as_sorted(self, track_excitations=True, track_indices=True):
Returns a sorted version of the state space
:returns:_
apply_selection_rules(self, selection_rules, target_dimensions=None, filter_space=None, parallelizer=None, logger=None, iterations=1, new_state_space_class=None, track_excitations=True, track_indices=True):
Generates a new state space from the application of selection_rules to the state space.
Returns a BasisMultiStateSpace where each state tracks the effect of the application of the selection rules
up to the number of iteration specified.
basis:Anyselection_rules:Anystates:Anyiterations:Anyfilter_space:Any:returns:SelectionRuleStateSpace
permutationally_reduce(self):
get_representation_indices(self, other=None, selection_rules=None, freqs=None, freq_threshold=None, filter=None, return_filter=False, parallelizer=None):
Generates a set of indices that can be fed into a Representation to provide a sub-representation
in this state space.
Basically just takes all pairs of indices.
Only returns the upper-triangle indices
:returns:_
get_representation_brakets(self, other=None, selection_rules=None, freqs=None, freq_threshold=None, filter=None, return_filter=False, track_excitations=True):
Generates a BraKetSpace that can be fed into a Representation
Only returns the upper-triangle pairs because we assume symmetry
:returns:_
take_subspace(self, sel, assume_sorted=False, track_excitations=True, track_indices=True):
Returns a subsample of the space. Intended to be a cheap operation, so samples along either the indices or the excitations, depending on which we have If we know the subsample is sorted then we can actually reuse more information and so we make use of that
sel:Any:returns:_
take_subdimensions(self, inds, exc=None):
Returns a subsample of the space with some dimensions dropped
inds:Any:returns:_
take_states(self, states, sort=False, assume_sorted=False, track_excitations=True, track_indices=True):
Takes the set of specified states from the space. A lot like take_subspace, but operates on states, not indices
states:Any:returns:_
drop_subspace(self, sel, track_excitations=True, track_indices=True):
Returns a subsample of the space. Intended to be a cheap operation, so samples along either the indices or the excitations, depending on which we have
sel:Any:returns:_
drop_subdimensions(self, inds, track_excitations=True, track_indices=True):
Returns a subsample of the space with some dimensions dropped
inds:Any:returns:_
drop_states(self, states, track_excitations=True, track_indices=True):
Takes the set of specified states from the space. A lot like take_subspace, but operates on states, not indices
states:Any:returns:_
split(self, chunksize):
Splits the space up into chunks of at max chunksize
chunksize:int:returns:Iterable[BasisStateSpace]
concatenate(self, other, track_excitations=True, track_indices=True):
Just does a direct concatenation with no unions or any of that
other:Any:returns:_
union(self, other, sort=False, track_excitations=True, track_indices=True):
Returns a merged version of self and other, making use of as much of the information inherent in both as is possible
other:BasisStateSpace:returns:_
intersection(self, other, sort=False, track_excitations=True, track_indices=True):
Returns an intersected self and other
other:BasisStateSpace:returns:_
difference(self, other, sort=False, track_excitations=True, track_indices=True):
Returns an diff’ed self and other
other:BasisStateSpace:returns:_
__repr__(self):
__eq__(self, other):
other:Any:returns:_