Skip to main content

is_real

Method of Operator.

is_real() -> bool

Returns true if the operator has a real matrix representation. Conservative method: May return false for operators that are actually real. When true is returned, it is guaranteed to be correct.

Returns

true if the operator is provably real, false otherwise (including cases where it may be real but cannot be verified).

Example

var r1 = is_real(X(0)) // true (provably real)
var r2 = X(0).is_real() // true
var r3 = is_real(Y(0)) // false (provably not real)
var r4 = is_real(-1i * operator_dense(1i*random([2,2],as_real), 0)) // false (conservative, even though result is real)