symmray.flat.flat_data_common ============================= .. py:module:: symmray.flat.flat_data_common .. autoapi-nested-parse:: Common interface methods for arrays or vectors with flat backend storage. Classes ------- .. autoapisummary:: symmray.flat.flat_data_common.FlatCommon Module Contents --------------- .. py:class:: FlatCommon Mixin class for flat arrays. .. py:attribute:: __slots__ :value: ('_blocks', '_sectors', 'backend') .. py:method:: _init_flatcommon(sectors, blocks) .. py:method:: _new_with_flatcommon(sectors, blocks) .. py:method:: _copy_flatcommon(deep=False) .. py:method:: _copy_with_flatcommon(sectors=None, blocks=None) .. py:method:: _modify_flatcommon(sectors=None, blocks=None) .. py:method:: _to_pytree_flatcommon() .. py:property:: 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. .. py:property:: 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. .. py:property:: dtype Get the dtype name for the blocks. .. py:method:: _get_shape_blocks_full() -> tuple[int, Ellipsis] Get the full shape of the stacked blocks, including the number of blocks. .. py:property:: shape_block :type: tuple[int, Ellipsis] Get the shape of an individual block. .. py:property:: ndim :type: int Get the number of effective dimensions of the array. .. py:property:: num_blocks :type: int Get the number of blocks in the array. .. py:method:: get_any_array() Get an arbitrary (the first) block from the stack. .. py:method:: get_namespace() Get the array namespace for the underlying blocks. .. py:method:: get_scalar_element() Get the scalar element from a scalar block array. .. py:method:: is_zero(tol=1e-12) Check if all blocks are zero up to a tolerance. .. py:method:: get_params() Interface for getting underlying arrays. .. py:method:: _set_params_flatcommon(params) Interface for setting underlying arrays. .. py:method:: apply_to_arrays(fn) .. py:method:: item() Convert block array to a scalar if it is a scalar block array. .. py:method:: _binary_blockwise_op_abelian(other, fn, missing=None, inplace=False) .. py:method:: _do_reduction(fn) .. py:method:: norm()