symmray.flat.flat_vector ======================== .. py:module:: symmray.flat.flat_vector .. autoapi-nested-parse:: Block vector class with flat backend. Classes ------- .. autoapisummary:: symmray.flat.flat_vector.FlatVector Module Contents --------------- .. py:class:: FlatVector(sectors, blocks) Bases: :py:obj:`symmray.flat.flat_data_common.FlatCommon`, :py:obj:`symmray.vector_common.VectorCommon`, :py:obj:`symmray.common.SymmrayCommon` Class 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. :param sectors: The vector of charges, with shape (num_blocks,). :type sectors: array_like :param blocks: The stack of vectors, with shape (num_blocks, charge_subsize). :type blocks: array_like .. py:attribute:: __slots__ :value: ('_blocks', '_sectors', 'backend') .. py:method:: from_blocks(blocks) :classmethod: Create a flat vector from a dictionary of blocks. :param blocks: Dictionary mapping sector (charge) to block (array). :type blocks: dict .. py:method:: from_blockvector(blockvector) :classmethod: Create a flat backend vector from a sparse backend BlockVector. :param blockvector: The BlockVector to convert. :type blockvector: BlockVector .. py:method:: to_blockvector() Convert to a sparse backend BlockVector. .. py:method:: from_fill_fn(fill_fn, sectors, charge_size) :classmethod: Create a flat vector by filling blocks using a function that takes a shape and returns an array. :param fill_fn: Function that takes a shape tuple and returns an array of that shape. :type fill_fn: callable :param sectors: 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. :type sectors: array_like or int or str :param charge_size: The size of each charge block. :type charge_size: int :param like: :type like: str or array_like, optional .. py:method:: rand(sectors, charge_size, dist='normal', seed=None, like='numpy') :classmethod: .. py:property:: size The total size of all elements in the vector. .. py:property:: shape :type: tuple[int, Ellipsis] Get the effective shape of the vector. .. py:method:: copy(deep=False) -> FlatVector .. py:method:: copy_with(sectors=None, blocks=None) -> FlatVector 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. .. py:method:: modify(sectors=None, blocks=None) 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. .. py:method:: check() .. py:method:: sort_stack(inplace=False) Sort the sectors and associated blocks in ascending order of charge. .. py:method:: _binary_blockwise_op(other, fn, missing=None, inplace=False) .. py:method:: to_dense() .. py:method:: __repr__()