toqito.matrices.comparison¶
Computes comparison matrix.
Module Contents¶
- toqito.matrices.comparison.comparison(mat)[source]¶
Compute comparison matrix of a given square matrix.
This function computes the comparison matrix (M(A)) for a square matrix (A) as defined in [@WikiComparisonMatrix]. For each entry, the diagonal entries are given by the absolute value of the original diagonal entries of (A), while the off-diagonal entries are given by minus the absolute value of the corresponding entries. In other words,
]
Examples
```python exec=”1” source=”above” import numpy as np from toqito.matrices import comparison A = np.array([[2, -1],
[3, 4]])
- Raises:
ValueError – If the input matrix is not square.
- Parameters:
mat (numpy.ndarray) – The input square matrix.
- Returns:
The comparison matrix of the input matrix.
- Return type:
numpy.ndarray