Skip to main contentIBM Quantum Documentation
This page is from an old version of Qiskit SDK Go to the latest version
Important

IBM Quantum Platform is moving and this version will be sunset on July 1. To get started on the new platform, read the migration guide.

CommutationChecker

class CommutationChecker

GitHub

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

CommutationChecker.commute(op1, qargs1, cargs1, op2, qargs2, cargs2)

Checks if two Operations commute.

Parameters

  • op1 (Operation) – first operation.
  • qargs1 (List) – first operation’s qubits.
  • cargs1 (List) – first operation’s clbits.
  • op2 (Operation) – second operation.
  • qargs2 (List) – second operation’s qubits.
  • cargs2 (List) – second operation’s clbits.

Returns

whether two operations commute.

Return type

bool

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