symmray.sparse.sparse_vector

Sparse backend block vector class.

Classes

BlockVector

Class for storing block vectors with sparse storage, e.g. for the

Module Contents

class symmray.sparse.sparse_vector.BlockVector(blocks)[source]

Bases: symmray.sparse.sparse_data_common.BlockCommon, symmray.vector_common.VectorCommon, symmray.common.SymmrayCommon

Class for storing block vectors with sparse storage, e.g. for the singular- or eigen- values of a matrix.

This is equivalent to the diagonal of a zero charge abelian matrix.

Parameters:

blocks (dict) – A dictionary mapping sector keys to array blocks.

__slots__ = ('_blocks',)
ndim = 1
copy()[source]
property size

The total size of all elements in the vector.

property shape

Get the effective shape of the vector.

_binary_blockwise_op(other, fn, missing=None, inplace=False)[source]
check()[source]

Check that the block vector is well formed.

to_flat()[source]

Convert the block sparse vector to a flat vector.

to_dense()[source]

Convert the block vector to a dense array.

allclose(other, **allclose_opts)[source]
test_allclose(other, **allclose_opts)[source]

Like allclose but raises an AssertionError with details if not close.

__repr__()[source]