symmray.flat.flat_vector¶
Block vector class with flat backend.
Classes¶
Class for storing block vectors with flat storage, e.g. for the |
Module Contents¶
- class symmray.flat.flat_vector.FlatVector(sectors, blocks)[source]¶
Bases:
symmray.flat.flat_data_common.FlatCommon,symmray.vector_common.VectorCommon,symmray.common.SymmrayCommonClass for storing block vectors with flat 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:
sectors (array_like) – The vector of charges, with shape (num_blocks,).
blocks (array_like) – The stack of vectors, with shape (num_blocks, charge_subsize).
- __slots__ = ('_blocks', '_sectors', 'backend')¶
- classmethod from_blocks(blocks)[source]¶
Create a flat vector from a dictionary of blocks.
- Parameters:
blocks (dict) – Dictionary mapping sector (charge) to block (array).
- classmethod from_blockvector(blockvector)[source]¶
Create a flat backend vector from a sparse backend BlockVector.
- Parameters:
blockvector (BlockVector) – The BlockVector to convert.
- classmethod from_fill_fn(fill_fn, sectors, charge_size)[source]¶
Create a flat vector by filling blocks using a function that takes a shape and returns an array.
- Parameters:
fill_fn (callable) – Function that takes a shape tuple and returns an array of that shape.
sectors (array_like or int or str) – The vector of charges, with shape (num_blocks,). If an integer is given, it is assumed to be Z{N} symmetry and the sectors are set to range(N). If a string is given, it is assumed to be of the form “ZN” for some integer N.
charge_size (int) – The size of each charge block.
like (str or array_like, optional)
- property size¶
The total size of all elements in the vector.
- copy(deep=False) FlatVector[source]¶
- copy_with(sectors=None, blocks=None) FlatVector[source]¶
Create a copy of the vector with some attributes replaced. Note that checks are not performed on the new properties, this is intended for internal use.
- modify(sectors=None, blocks=None)[source]¶
Modify the vector in place with some attributes replaced. Note that checks are not performed on the new properties, this is intended for internal use.