toqito.matrix_props.is_normal ============================= .. py:module:: toqito.matrix_props.is_normal .. autoapi-nested-parse:: Checks if the matrix is a normal matrix. Module Contents --------------- .. py:function:: is_normal(mat, rtol = 1e-05, atol = 1e-08) Determine if a matrix is normal [@WikiNorm]. A matrix is normal if it commutes with its adjoint \[ \begin{equation} [X, X^*] = 0, \end{equation} \] or, equivalently if \[ \begin{equation} X^* X = X X^* \end{equation}. \] .. rubric:: Examples Consider the following matrix \[ A = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix} \] our function indicates that this is indeed a normal matrix. ```python exec="1" source="above" import numpy as np from toqito.matrix_props import is_normal A = np.identity(4) print(is_normal(A)) ``` Alternatively, the following example matrix \(B\) defined as \[ B = \begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{pmatrix} \] is not normal. ```python exec="1" source="above" import numpy as np from toqito.matrix_props import is_normal B = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) print(is_normal(B)) ``` :param mat: The matrix to check. :param rtol: The relative tolerance parameter (default 1e-05). :param atol: The absolute tolerance parameter (default 1e-08). :returns: Returns `True` if the matrix is normal and `False` otherwise.