toqito.matrix_props.is_block_positive¶
Checks if the matrix is block positive.
Module Contents¶
- toqito.matrix_props.is_block_positive.is_block_positive(mat, k=1, dim=None, effort=2, rtol=1e-05)[source]¶
Check if matrix is block positive [@Johnston_2012_Norms].
Examples
The swap operator is always block positive, since it is the Choi matrix of the transpose map.
```python exec=”1” source=”above” from toqito.perms.swap_operator import swap_operator from toqito.matrix_props.is_block_positive import is_block_positive
mat = swap_operator(3)
print(is_block_positive(mat=mat)) ```
However, it’s not 2 - block positive.
```python exec=”1” source=”above” from toqito.perms.swap_operator import swap_operator from toqito.matrix_props.is_block_positive import is_block_positive
mat = swap_operator(3)
print(is_block_positive(mat=mat, k=2)) ```
- Raises:
RuntimeError – Unable to determine k-block positivity. Please consider increasing the relative tolerance or the
effort level. –
- Parameters:
mat (numpy.ndarray) – A bipartite Hermitian operator.
k (int) – A positive integer indicating that the function should determine whether or not the input operator is k-block
positive
i.e.
with (whether or not it remains nonnegative under left and right multiplication by vectors)
k
dim (int | list[int] | None) – The dimension of the two sub-systems. By default it’s assumed to be equal.
effort (int) – An integer value indicating the amount of computation you want to devote to determine block positivity
up. (before giving)
rtol (float) – The relative tolerance parameter (default 1e-05).
- Returns:
Return True if matrix is k-block positive definite, False if not, or raise a runtime error if we are unable to determine whether or not the operator is block positive.
- Return type:
bool | RuntimeError