Skip to main contentIBM Quantum Documentation
This page is from an old version of Qiskit SDK and does not exist in the latest version. We recommend you migrate to the latest version. See the release notes for more information.

qiskit.aqua.operators.legacy.commutator

commutator(op_a, op_b, op_c=None, sign=False, threshold=1e-12)

GitHub

Compute commutator of op_a and op_b or the symmetric double commutator of op_a, op_b and op_c.

See McWeeny chapter 13.6 Equation of motion methods (page 479)

If only op_a and op_b are provided:

result = A*B - B*A;

If op_a, op_b and op_c are provided:

result = 0.5 * (2*A*B*C + 2*C*B*A - B*A*C - C*A*B - A*C*B - B*C*A)

Parameters

Returns

the commutator

Return type

WeightedPauliOperator

Note

For the final chop, the original codes only contain the paulis with real coefficient.

Was this page helpful?
Report a bug or request content on GitHub.