symmray.flat.flat_index¶
Index objects for flat arrays.
Classes¶
Simple class to store dualness and any fuse information of an index. |
|
Information required to unfuse a fused index. |
Module Contents¶
- class symmray.flat.flat_index.FlatIndex(num_charges, charge_size, dual=False, subinfo=None, linearmap=None)[source]¶
Bases:
symmray.index_common.IndexSimple class to store dualness and any fuse information of an index.
- Parameters:
dual (bool, optional) – Whether the index is dual (i.e., contributes a negative sign to the corresponding charge). Default is False.
subinfo (FlatSubIndexInfo, optional) – Information about the subindex, if this index is a fused index. Default is None, which means the index is not fused.
- __slots__ = ('_num_charges', '_charge_size', '_dual', '_subinfo')¶
- _num_charges¶
- _charge_size¶
- _dual = False¶
- _subinfo = None¶
- _linearmap = None¶
- copy_with(num_charges=None, charge_size=None, dual=None, linearmap=None, **kwargs)[source]¶
A copy of this index with some attributes replaced. Note that checks are not performed on the new propoerties, this is intended for internal use.
- to_pytree()[source]¶
Convert this flat index to a pytree purely of non-symmray containers and objects.
- classmethod from_pytree(pytree)[source]¶
Create a flat index from a pytree purely of non-symmray containers and objects.
- property subshape¶
- select_charge(charge, subselect=None) FlatIndex[source]¶
Drop all but the specified charge from this index.
- linear_to_charge_and_offset(i)[source]¶
Given a linear index
iinto this index (as if it were a dense array), return the corresponding charge and offset within that charge block.- Parameters:
i (int) – The linear index into this index.
- Returns:
charge (hashable) – The charge corresponding to the linear index.
offset (int) – The offset within the charge block corresponding to the linear index.
- class symmray.flat.flat_index.FlatSubIndexInfo(indices, subkeys)[source]¶
Bases:
symmray.index_common.SubInfoInformation required to unfuse a fused index.
- Parameters:
indices (tuple[FlatIndex]) – The indices that have been fused.
subkeys (array_like) – The subkeys for the fused index, with shape (ncharge, nsectors, nsubcharges). I.e. the first axis selects the overall fused charge, the second axis selects the subsector within that charge, and the third axis selects the individual charge within that subsector.
- __slots__ = ('_indices', '_subkeys', '_ncharge', '_nsectors', '_nsubcharges')¶
- _indices¶
- _subkeys¶
- to_pytree()[source]¶
Convert this flat subindex info to a pytree purely of non-symmray containers and objects.
- classmethod from_pytree(pytree)[source]¶
Create a flat subindex info from a pytree purely of non-symmray containers and objects.
- property subkeys¶
The subkeys for the fused index.