symmray.flat.flat_data_common

Common interface methods for arrays or vectors with flat backend storage.

Classes

FlatCommon

Mixin class for flat arrays.

Module Contents

class symmray.flat.flat_data_common.FlatCommon[source]

Mixin class for flat arrays.

__slots__ = ('_blocks', '_sectors', 'backend')
_init_flatcommon(sectors, blocks)[source]
_new_with_flatcommon(sectors, blocks)[source]
_copy_flatcommon(deep=False)[source]
_copy_with_flatcommon(sectors=None, blocks=None)[source]
_modify_flatcommon(sectors=None, blocks=None)[source]
_to_pytree_flatcommon()[source]
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.

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.

property dtype

Get the dtype name for the blocks.

_get_shape_blocks_full() tuple[int, Ellipsis][source]

Get the full shape of the stacked blocks, including the number of blocks.

property shape_block: tuple[int, Ellipsis]

Get the shape of an individual block.

property ndim: int

Get the number of effective dimensions of the array.

property num_blocks: int

Get the number of blocks in the array.

get_any_array()[source]

Get an arbitrary (the first) block from the stack.

get_namespace()[source]

Get the array namespace for the underlying blocks.

get_scalar_element()[source]

Get the scalar element from a scalar block array.

is_zero(tol=1e-12)[source]

Check if all blocks are zero up to a tolerance.

get_params()[source]

Interface for getting underlying arrays.

_set_params_flatcommon(params)[source]

Interface for setting underlying arrays.

apply_to_arrays(fn)[source]
item()[source]

Convert block array to a scalar if it is a scalar block array.

_binary_blockwise_op_abelian(other, fn, missing=None, inplace=False)[source]
_do_reduction(fn)[source]
norm()[source]