is_hermitian
Method of Operator.
is_hermitian() -> bool
Returns true if the operator is Hermitian (self-adjoint). Conservative method: May return false for operators that are actually Hermitian. When true is returned, it is guaranteed to be correct.
Returns
true if the operator is provably Hermitian, false otherwise (including cases where it may be Hermitian but cannot be verified).
Example
var h1 = is_hermitian(X(0) + Z(0)) // true (provably Hermitian)
var h2 = X(0).is_hermitian() // true
var h3 = is_hermitian(Sgate(0)) // false (provably not Hermitian)