pg_utils.numerics.matrices.LabeledBlockArray

class pg_utils.numerics.matrices.LabeledBlockArray(array: ndarray, block_names: List[str], block_ranges: List[int])[source]

Bases: object

Block 1-D array with labels assigned to blocks

LabeledBlockMatrix wraps around an array, so that blocks of it can be accessed using a single string

Parameters:
  • _block_idx – dict, key=label(str) -> value=indices of the block (slice)

  • _array – np.ndarray, the underlying matrix

__init__(array: ndarray, block_names: List[str], block_ranges: List[int]) None[source]
Parameters:
  • block_names – array-like, names of the blocks

  • block_ranges – array of integers, the size of each block

..Example: for instance,

LabeledBlockArray(np.arange(10), [“A”, “B”, “C”], [3, 4, 3]) will be interpreted in the following sense: [—A—|-----B------|—C—] [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

Methods

__init__(array, block_names, block_ranges)

param block_names:

array-like, names of the blocks