-
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
Boolean circuits as gates #13333
Boolean circuits as gates #13333
Conversation
One or more of the following people are relevant to this code:
|
Pull Request Test Coverage Report for Build 11595891469Warning: 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.
Thanks for adding this! I left some small comments below 🙂
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, thank you!
Summary
Part of #13046. Adds the following
Gate
classes in addition to existingQuantumCircuit
classes:AndGate
forAND
OrGate
forOR
BitwiseXorGate
forXOR
InnerProductGate
forInnerProduct
Details and comments
To be honest, the difference between an
AndGate
gate and anAND
quantum circuit is rather small. In addition to the general consistency pursued by #13046, it might be just a tiny bit more ergonomic to typeqc.append(AndGate(5), [0, 1, 2, 3, 4, 5])
rather thanqc.append(AND(5).to_gate(), [0, 1, 2, 3, 4, 5])
, and the first circuit has one less level of nestedness than the second (in the former case it takes one call todecompose
to see the definition circuit, and in the latter case - two). This applies to all 4 gates.Actually, another benefit for
AndGate
andOrGate
is that as their definitions are built on top of MCX gates, we are able to use all the synthesis methods that leverage ancilla qubits via the "mcx" plugin mechanism.