-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Port RemoveDiagonalGatesBeforeMeasure to rust #13065
Conversation
One or more of the following people are relevant to this code:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good, thanks for doing this. I just left a few small inline comments which I think should fix the test failures too.
qiskit/transpiler/passes/optimization/remove_diagonal_gates_before_measure.py
Show resolved
Hide resolved
StandardGate::CSGate, | ||
StandardGate::CSdgGate, | ||
]); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that there are some 1-qubit and 2-qubit diagonal gates that did not appear in the original list, so I added them here (I'll add them to the tests later).
There is also a 3-qubit diagonal gate: CCZGate
(which was not added in this PR)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact, there is also an n-qubit diagonal gate: MCPhaseGate
. This gate was not handled this PR.
This is since the algorithm given here that goes over all the successors of each of the predecessors would be O(n^2)
and not O(n)
.
the failing test should be fixed after #13067 is merged |
Performance comparison of the old python code and the new rust code for a
|
Pull Request Test Coverage Report for Build 10719300369Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, also great to add the phase gates 👍🏻
As you mentioned, there is MCPhaseGate
which we could handle, as well as DiagonalGate
or any AnnotatedOperation
with a diagonal base gate. But that would be something for a follow up (we would also make sure to remove these before any further decomposition occurs).
Summary
close #12255
Details and comments