qiskit-documentation/docs/api/qiskit/0.39/qiskit.circuit.CommutationC...

42 lines
1.6 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: CommutationChecker
description: API reference for qiskit.circuit.CommutationChecker
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit.circuit.CommutationChecker
---
# CommutationChecker
<Class id="qiskit.circuit.CommutationChecker" isDedicatedPage={true} github="https://github.com/qiskit/qiskit/tree/stable/0.22/qiskit/circuit/commutation_checker.py" signature="CommutationChecker" modifiers="class">
Bases: `object`
This code is essentially copy-pasted from commutative\_analysis.py. This code cleverly hashes commutativity and non-commutativity results between DAG nodes and seems quite efficient for large Clifford circuits. They may be other possible efficiency improvements: using rule-based commutativity analysis, evicting from the cache less useful entries, etc.
## Methods
### commute
<Function id="qiskit.circuit.CommutationChecker.commute" signature="CommutationChecker.commute(op1, qargs1, cargs1, op2, qargs2, cargs2)">
Checks if two Operations commute.
**Parameters**
* **op1** ([`Operation`](qiskit.circuit.Operation "qiskit.circuit.operation.Operation")) first operation.
* **qargs1** (`List`) first operations qubits.
* **cargs1** (`List`) first operations clbits.
* **op2** ([`Operation`](qiskit.circuit.Operation "qiskit.circuit.operation.Operation")) second operation.
* **qargs2** (`List`) second operations qubits.
* **cargs2** (`List`) second operations clbits.
**Returns**
whether two operations commute.
**Return type**
bool
</Function>
</Class>