# core.HasBlocks

``` python
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](#laplacekit.core.HasBlocks.add_per_block) | The operator with a precision added to each block. |
| [block_sizes](#laplacekit.core.HasBlocks.block_sizes) | Each block’s flat size. |

### add_per_block

``` python
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

``` python
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. |
