-
Notifications
You must be signed in to change notification settings - Fork 2.6k
equivalence of toffoli in terms of cx and sqrt(cx) #7279
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
Conversation
771dc46
to
130672e
Compare
I hope there is a test that checks all additions to the standard equivalence library are correct |
yep, and it caught my off-by-global-phase error. |
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 straightforwards, and the equivalences look right now in local testing.
I think we're ok without a changelog, unless we normally put one in for additional equivalences?
Are there any other equivalences in the equivalence library (or that we should add to it) that can be written more efficiently with a csx gate? |
Pull Request Test Coverage Report for Build 1476434419
💛 - Coveralls |
I think we are ok without one too.
This can be extended to multi-controlled toffolis, see pg 17 of barenco https://arxiv.org/pdf/quant-ph/9503016.pdf |
an example that can be a use case for backendV2 and its compiler support.
ccx can be written as 2 cx and 3 csx (which is better than only if cx was available)
cx and csx can also be written as rzx(pi/2) and rzx(pi/4) respectively.
so in principle the basis translator should be able to rewrite ccx in terms of rzx(pi/2) and rzx(pi/4) if that's the instruction set that the backend has.