hermitian
¶
Hermitian-matrix checks.
hermitian
¶
Return whether the NumPy matrix H is Hermitian.
A square matrix \(H\) is Hermitian when it equals its conjugate transpose, \(H = H^\dagger\).
Parameters:
-
H(ndarray) –Square complex matrix.
Returns:
-
bool–TrueifHis Hermitian up to numerical tolerance, elseFalse.
Examples:
The Pauli \(Y\) matrix is Hermitian:
import numpy as np
from shadowsim.utils.hermitian import hermitian
Y = np.array([[0.0, -1j], [1j, 0.0]])
print(hermitian(Y))
A non-symmetric complex matrix is not:
import numpy as np
from shadowsim.utils.hermitian import hermitian
print(hermitian(np.array([[1.0 + 2j, 0.0], [0.0, 0.0]])))