symmray.flat.flat_abelian_array¶
Abelian symmetric arrays with flat backend.
Classes¶
Base class for abelian arrays with flat storage and cyclic symmetry. |
|
Base class for abelian arrays with flat storage and cyclic symmetry. |
Module Contents¶
- class symmray.flat.flat_abelian_array.AbelianArrayFlat(sectors, blocks, indices, symmetry=None, label=None)[source]¶
Bases:
symmray.flat.flat_array_common.FlatArrayCommon,symmray.flat.flat_data_common.FlatCommon,symmray.bosonic_common.BosonicCommon,symmray.array_common.ArrayCommon,symmray.common.SymmrayCommonBase class for abelian arrays with flat storage and cyclic symmetry.
- Parameters:
sectors (array_like) – The stack of sector keys, with shape (num_blocks, ndim). Each row represents a sector of a corresponding block, and each column represents a charge in a given axis.
blocks (array_like) – The stack of array blocks, with shape (num_blocks, *shape_block), i.e. ndim + 1 dimensions, where the first dimension is the block index, which should match the first dimension of sectors, and the rest are the dimensions of individual blocks.
indices (sequence[FlatIndex]) – Indices describing the dualness and any subindex information for each dimension of the array. If bools are supplied, they will be converted to a FlatIndex with the corresponding dualness, and no subindex information.
symmetry (str or Symmetry, optional) – The symmetry of the array, if not using a specific symmetry class.
- __slots__ = ('_blocks', '_indices', '_label', '_sectors', '_symmetry', 'backend')¶
- fermionic = False¶
- static_symmetry = None¶
- new_with(sectors, blocks, indices, label=None) AbelianArrayFlat[source]¶
Create a new flat abelian array of the same class as this one. Unlike copy, this does not copy over any existing data and drops for example label.
- copy(deep=False) AbelianArrayFlat[source]¶
Create a copy of the array.
- copy_with(sectors=None, blocks=None, indices=None) AbelianArrayFlat[source]¶
A copy of this block array with some attributes replaced. Note that checks are not performed on the new properties, this is intended for internal use.
- modify(sectors=None, blocks=None, indices=None) AbelianArrayFlat[source]¶
Modify this flat array in place with some attributes replaced. Note that checks are not performed on the new properties, this is intended for internal use.
- classmethod from_pytree(pytree) AbelianArrayFlat[source]¶
Create a flat abelian array from a pytree purely of non-symmray containers and objects.
- classmethod from_blocks(blocks, indices, symmetry=None, label=None) AbelianArrayFlat[source]¶
Create a flat array from an explicit dictionary of blocks, and sequence of indices or duals.
- Parameters:
blocks (dict[tuple[int, ...], array_like]) – A dictionary mapping sector keys (tuples of charges) to blocks (arrays).
indices (sequence[FlatIndex] | sequence[bool]) – A sequence of indices describing the dualness and any subindex information for each dimension of the array. If bools are supplied, they will be converted to a FlatIndex with the corresponding dualness, and no subindex information.
symmetry (str or Symmetry, optional) – The symmetry of the array, if not using a specific symmetry class.
label (hashable, optional) – An optional label for the array, potentially needed for ordering dummy odd fermionic modes.
- Return type:
- classmethod from_blocksparse(x: symmray.sparse.sparse_abelian_array.AbelianArray, symmetry=None) AbelianArrayFlat[source]¶
Create a flat abelian array from a blocksparse abelian array.
- Parameters:
x (AbelianArray) – The blocksparse abelian array to convert.
symmetry (str or Symmetry, optional) – The symmetry to use. If not supplied, the symmetry of x is used.
- to_blocksparse() symmray.sparse.sparse_abelian_array.AbelianArray[source]¶
Create a blocksparse abelian array from this flat abelian array.
- sort_stack(axes=None, all_axes=None, inplace=False) AbelianArrayFlat[source]¶
Lexicgraphic sort the stack of sectors and blocks according to the values of charges in the specified axes, optionally filling in the rest of the axes with the remaining axes in the order they appear.
- Parameters:
axes (int | tuple[int, ...], optional) – The axes to sort by. If a single integer is given, it will be interpreted as the axis to sort by. If a tuple of integers is given, it will be interpreted as the axes to sort by in order. Default is None, if all_axes is also None or True, this will sort all axes in their current order.
all_axes (bool, optional) – Whether to include all non-specified axes as tie-breakers, after the specified axes. If
None, the default, this will be True if axes is not supplied explicitly, and False otherwise.inplace (bool, optional) – Whether to perform the operation inplace or return a new array. Default is False, which returns a new array.
- class symmray.flat.flat_abelian_array.Z2ArrayFlat(sectors, blocks, indices, symmetry=None, label=None)[source]¶
Bases:
AbelianArrayFlatBase class for abelian arrays with flat storage and cyclic symmetry.
- Parameters:
sectors (array_like) – The stack of sector keys, with shape (num_blocks, ndim). Each row represents a sector of a corresponding block, and each column represents a charge in a given axis.
blocks (array_like) – The stack of array blocks, with shape (num_blocks, *shape_block), i.e. ndim + 1 dimensions, where the first dimension is the block index, which should match the first dimension of sectors, and the rest are the dimensions of individual blocks.
indices (sequence[FlatIndex]) – Indices describing the dualness and any subindex information for each dimension of the array. If bools are supplied, they will be converted to a FlatIndex with the corresponding dualness, and no subindex information.
symmetry (str or Symmetry, optional) – The symmetry of the array, if not using a specific symmetry class.
- static_symmetry¶