matrix_props.is_normal¶
Checks if the matrix is a normal matrix.
Functions¶
Module Contents¶
- matrix_props.is_normal.is_normal(mat, rtol=1e-05, atol=1e-08)¶
Determine if a matrix is normal [1].
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}.\]Examples
Consider the following matrix
\[\begin{split}A = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix}\end{split}\]our function indicates that this is indeed a normal matrix.
>>> from toqito.matrix_props import is_normal >>> import numpy as np >>> A = np.identity(4) >>> is_normal(A) True
Alternatively, the following example matrix \(B\) defined as
\[\begin{split}B = \begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{pmatrix}\end{split}\]is not normal.
>>> from toqito.matrix_props import is_normal >>> import numpy as np >>> B = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) >>> is_normal(B) False
References
- Parameters:
mat (numpy.ndarray) – The matrix to check.
rtol (float) – The relative tolerance parameter (default 1e-05).
atol (float) – The absolute tolerance parameter (default 1e-08).
- Returns:
Returns
True
if the matrix is normal andFalse
otherwise.- Return type:
bool