qiskit.aqua.operators.legacy.check_commutativity¶
-
check_commutativity
(op_1, op_2, anti=False)[source]¶ Check the (anti-)commutativity between two operators.
- Parameters
op_1 (WeightedPauliOperator) – operator
op_2 (WeightedPauliOperator) – operator
anti (bool) – if True, check anti-commutativity, otherwise check commutativity.
- Returns
whether or not two operators are commuted or anti-commuted.
- Return type
bool