symmray.flat.flat_abelian_array =============================== .. py:module:: symmray.flat.flat_abelian_array .. autoapi-nested-parse:: Abelian symmetric arrays with flat backend. Classes ------- .. autoapisummary:: symmray.flat.flat_abelian_array.AbelianArrayFlat symmray.flat.flat_abelian_array.Z2ArrayFlat Module Contents --------------- .. py:class:: AbelianArrayFlat(sectors, blocks, indices, symmetry=None, label=None) Bases: :py:obj:`symmray.flat.flat_array_common.FlatArrayCommon`, :py:obj:`symmray.flat.flat_data_common.FlatCommon`, :py:obj:`symmray.bosonic_common.BosonicCommon`, :py:obj:`symmray.array_common.ArrayCommon`, :py:obj:`symmray.common.SymmrayCommon` Base class for abelian arrays with flat storage and cyclic symmetry. :param sectors: 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. :type sectors: array_like :param blocks: 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. :type blocks: array_like :param indices: 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. :type indices: sequence[FlatIndex] :param symmetry: The symmetry of the array, if not using a specific symmetry class. :type symmetry: str or Symmetry, optional .. py:attribute:: __slots__ :value: ('_blocks', '_indices', '_label', '_sectors', '_symmetry', 'backend') .. py:attribute:: fermionic :value: False .. py:attribute:: static_symmetry :value: None .. py:method:: check() Check the internal consistency of the array. .. py:method:: new_with(sectors, blocks, indices, label=None) -> AbelianArrayFlat 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`. .. py:method:: copy(deep=False) -> AbelianArrayFlat Create a copy of the array. .. py:method:: copy_with(sectors=None, blocks=None, indices=None) -> AbelianArrayFlat 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. .. py:method:: modify(sectors=None, blocks=None, indices=None) -> AbelianArrayFlat 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. .. py:method:: set_params(params) Set the underlying array blocks. .. py:method:: from_pytree(pytree) -> AbelianArrayFlat :classmethod: Create a flat abelian array from a pytree purely of non-symmray containers and objects. .. py:method:: from_blocks(blocks, indices, symmetry=None, label=None) -> AbelianArrayFlat :classmethod: Create a flat array from an explicit dictionary of blocks, and sequence of indices or duals. :param blocks: A dictionary mapping sector keys (tuples of charges) to blocks (arrays). :type blocks: dict[tuple[int, ...], array_like] :param indices: 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. :type indices: sequence[FlatIndex] | sequence[bool] :param symmetry: The symmetry of the array, if not using a specific symmetry class. :type symmetry: str or Symmetry, optional :param label: An optional label for the array, potentially needed for ordering dummy odd fermionic modes. :type label: hashable, optional :rtype: AbelianArrayFlat .. py:method:: from_blocksparse(x: symmray.sparse.sparse_abelian_array.AbelianArray, symmetry=None) -> AbelianArrayFlat :classmethod: Create a flat abelian array from a blocksparse abelian array. :param x: The blocksparse abelian array to convert. :type x: AbelianArray :param symmetry: The symmetry to use. If not supplied, the symmetry of `x` is used. :type symmetry: str or Symmetry, optional .. py:method:: to_blocksparse() -> symmray.sparse.sparse_abelian_array.AbelianArray Create a blocksparse abelian array from this flat abelian array. .. py:method:: _map_blocks(fn_sector=None, fn_block=None) .. py:method:: sort_stack(axes=None, all_axes=None, inplace=False) -> AbelianArrayFlat 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. :param axes: 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. :type axes: int | tuple[int, ...], optional :param all_axes: 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. :type all_axes: bool, optional :param inplace: Whether to perform the operation inplace or return a new array. Default is False, which returns a new array. :type inplace: bool, optional .. py:class:: Z2ArrayFlat(sectors, blocks, indices, symmetry=None, label=None) Bases: :py:obj:`AbelianArrayFlat` Base class for abelian arrays with flat storage and cyclic symmetry. :param sectors: 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. :type sectors: array_like :param blocks: 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. :type blocks: array_like :param indices: 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. :type indices: sequence[FlatIndex] :param symmetry: The symmetry of the array, if not using a specific symmetry class. :type symmetry: str or Symmetry, optional .. py:attribute:: static_symmetry