qiskit.aqua.operators.legacy.commutator
commutator(op_a, op_b, op_c=None, sign=False, threshold=1e-12)
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
- op_a (WeightedPauliOperator) – operator a
- op_b (WeightedPauliOperator) – operator b
- op_c (Optional(WeightedPauliOperator)) – operator c
- sign (bool) – False anti-commutes, True commutes
- threshold (float) – the truncation threshold
Returns
the commutator
Return type
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.