symmray.sparse.sparse_data_common¶
Common interface methods for arrays or vectors with block sparse backend storage.
Classes¶
Mixin class for arrays consisting of dicts of blocks. |
Functions¶
|
Module Contents¶
- class symmray.sparse.sparse_data_common.BlockCommon[source]¶
Mixin class for arrays consisting of dicts of blocks.
- __slots__ = ('_blocks',)¶
- property blocks¶
The blocks of the array.
- _map_blocks_blockcommon(fn_block=None, fn_sector=None, fn_filter=None)[source]¶
Map the blocks and their keys (sectors) of the array inplace.
- property dtype¶
Get the dtype name from an arbitrary block in the array.
- property backend¶
Get the backend name from an arbitrary block in the array.
- property num_blocks¶
The number of blocks in the array.
- property sectors¶
Get the sectors, i.e. keys of the blocks.
- _binary_blockwise_op_abelian(other, fn, missing=None, inplace=False)[source]¶
Apply a binary blockwise operation to two block arrays, which must have exactly the same sectors/keys, depending on missing.
- Parameters:
fn (callable) – Function to apply to the blocks of the arrays, with signature
fn(x_block, y_block) -> result_block.x (BlockCommon) – First block array.
y (BlockCommon) – Second block array.
missing (str, optional) – How to handle missing blocks. Can be “outer”, “inner” or None. Default is None which requires 1:1 matching blocks. If missing “outer” is specified, blocks present in only one of either array are simply kept. If missing “inner” is specified, blocks present in only one of either array are simply dropped.
inplace (bool, optional) – Whether to modify the first array in place. Default is False.
- Return type: