matrix_props.is_hermitian

Checks if the matrix is a Hermitian matrix.

Functions

is_hermitian(mat[, rtol, atol])

Check if matrix is Hermitian [1].

Module Contents

matrix_props.is_hermitian.is_hermitian(mat, rtol=1e-05, atol=1e-08)

Check if matrix is Hermitian [1].

A Hermitian matrix is a complex square matrix that is equal to its own conjugate transpose.

Examples

Consider the following matrix:

\[\begin{split}A = \begin{pmatrix} 2 & 2 +1j & 4 \\ 2 - 1j & 3 & 1j \\ 4 & -1j & 1 \end{pmatrix}\end{split}\]

our function indicates that this is indeed a Hermitian matrix as it holds that

\[A = A^*.\]
>>> from toqito.matrix_props import is_hermitian
>>> import numpy as np
>>> mat = np.array([[2, 2 + 1j, 4], [2 - 1j, 3, 1j], [4, -1j, 1]])
>>> is_hermitian(mat)
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 Hermitian.

>>> from toqito.matrix_props import is_hermitian
>>> import numpy as np
>>> mat = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
>>> is_hermitian(mat)
False

References

[1] (1,2)

Wikipedia. Hermitian matrix. URL: https://en.wikipedia.org/wiki/Hermitian_matrix.

Parameters:
  • mat (numpy.ndarray) – Matrix to check.

  • rtol (float) – The relative tolerance parameter (default 1e-05).

  • atol (float) – The absolute tolerance parameter (default 1e-08).

Returns:

Return True if matrix is Hermitian, and False otherwise.

Return type:

bool