Qiskit / qiskit

Qiskit is an open-source SDK for working with quantum computers at the level of extended quantum circuits, operators, and primitives.
https://www.ibm.com/quantum/qiskit
Apache License 2.0
5.1k stars 2.34k forks source link

Extend commutative cancellation for SX/Sdg/Tdg #13058

Open Cryoris opened 1 month ago

Cryoris commented 1 month ago

Summary

The CommmutativeCancellation pass didn't consider cancellations of Sdg/Tdg/SX/SXdg gates. This PR does a minor fix to add them.

Details and comments

There are other open points we might want to discuss:

Both these cases could be solved by e.g. always assuming an RX/RZ rotation gate to absorb the cancellations, but if finally the angles don't sum up to 0, we disregard the accumulation.

qiskit-bot commented 1 month ago

One or more of the following people are relevant to this code: