Skip to main content

core.HasBlocks

core.HasBlocks()

An operator on mappings keyed by block name, such as BlockDiag or Joint.

Per-block priors dispatch on this protocol.

Methods

Name Description
add_per_block The operator with a precision added to each block.
block_sizes Each block’s flat size.

add_per_block

core.HasBlocks.add_per_block(precision, /)

The operator with a precision added to each block.

A 0-dim precision[k] adds \(\lambda_k I\) to block \(k\); a vector adds \(\operatorname{diag}(\lambda_k)\).

Parameters

Name Type Description Default
precision Mapping[str, Tensor] A mapping from block name to a 0-dim tensor or a vector [P_k], with the operator’s block names. required

Returns

Name Type Description
Self An operator of the same type.

Raises

Name Type Description
StructureError precision is not a mapping, or its keys differ from the blocks. Implementations also raise it when a block can’t hold a diagonal.

block_sizes

core.HasBlocks.block_sizes()

Each block’s flat size.

Returns

Name Type Description
Mapping[str, int] A mapping from block name to flat size, in block order.