commutator

commutator(op_a, op_b, op_c=None, threshold=1e-12)[source]

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.