Skip to main contentIBM Quantum Documentation
You are viewing the API reference for an old version of Qiskit SDK. Switch to latest version

CommutationChecker

class qiskit.circuit.CommutationChecker

GitHub(opens in a new tab)

Bases: object(opens in a new tab)

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

commute(op1, qargs1, cargs1, op2, qargs2, cargs2, max_num_qubits=3)

Checks if two Operations commute. The return value of True means that the operations truly commute, and the return value of False means that either the operations do not commute or that the commutation check was skipped (for example, when the operations have conditions or have too many qubits).

Parameters

Returns

whether two operations commute.

Return type

bool(opens in a new tab)

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