toqito.matrix_props.is_hermitian ================================ .. py:module:: toqito.matrix_props.is_hermitian .. autoapi-nested-parse:: Checks if the matrix is a Hermitian matrix. Module Contents --------------- .. py:function:: is_hermitian(mat, rtol = 1e-05, atol = 1e-08) Check if matrix is Hermitian [@WikiHerm]. A Hermitian matrix is a complex square matrix that is equal to its own conjugate transpose. .. rubric:: Examples Consider the following matrix: \[ A = \begin{pmatrix} 2 & 2 +1j & 4 \\ 2 - 1j & 3 & 1j \\ 4 & -1j & 1 \end{pmatrix} \] our function indicates that this is indeed a Hermitian matrix as it holds that \[ A = A^*. \] ```python exec="1" source="above" import numpy as np from toqito.matrix_props import is_hermitian mat = np.array([[2, 2 + 1j, 4], [2 - 1j, 3, 1j], [4, -1j, 1]]) print(is_hermitian(mat)) ``` Alternatively, the following example matrix \(B\) defined as \[ B = \begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{pmatrix} \] is not Hermitian. ```python exec="1" source="above" import numpy as np from toqito.matrix_props import is_hermitian mat = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) print(is_hermitian(mat)) ``` :param mat: Matrix to check. :param rtol: The relative tolerance parameter (default 1e-05). :param atol: The absolute tolerance parameter (default 1e-08). :returns: Return True if matrix is Hermitian, and False otherwise.