45 lines
1.8 KiB
Plaintext
45 lines
1.8 KiB
Plaintext
---
|
||
title: commutator
|
||
description: API reference for qiskit.aqua.operators.legacy.commutator
|
||
in_page_toc_min_heading_level: 1
|
||
python_api_type: function
|
||
python_api_name: qiskit.aqua.operators.legacy.commutator
|
||
---
|
||
|
||
# qiskit.aqua.operators.legacy.commutator
|
||
|
||
<Function id="qiskit.aqua.operators.legacy.commutator" isDedicatedPage={true} github="https://github.com/qiskit-community/qiskit-aqua/tree/stable/0.9/qiskit/aqua/operators/legacy/common.py" signature="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*](qiskit.aqua.operators.legacy.WeightedPauliOperator "qiskit.aqua.operators.legacy.WeightedPauliOperator")) – operator a
|
||
* **op\_b** ([*WeightedPauliOperator*](qiskit.aqua.operators.legacy.WeightedPauliOperator "qiskit.aqua.operators.legacy.WeightedPauliOperator")) – operator b
|
||
* **op\_c** (*Optional(*[*WeightedPauliOperator*](qiskit.aqua.operators.legacy.WeightedPauliOperator "qiskit.aqua.operators.legacy.WeightedPauliOperator")*)*) – operator c
|
||
* **sign** (*bool*) – False anti-commutes, True commutes
|
||
* **threshold** (*float*) – the truncation threshold
|
||
|
||
**Returns**
|
||
|
||
the commutator
|
||
|
||
**Return type**
|
||
|
||
[WeightedPauliOperator](qiskit.aqua.operators.legacy.WeightedPauliOperator "qiskit.aqua.operators.legacy.WeightedPauliOperator")
|
||
|
||
<Admonition title="Note" type="note">
|
||
For the final chop, the original codes only contain the paulis with real coefficient.
|
||
</Admonition>
|
||
</Function>
|
||
|