-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Deprecate Two/ThreeQubitGate
#4207
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
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.
I think we should get rid of ThreeQubitGateTest
and always define a class ThreeQubitGate
when we need it. What do you think?
ThreeQubitGate
Two/ThreeQubitGate
Two/ThreeQubitGate
Two/ThreeQubitGate
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 % nits.
Wondering now if we should make Gate generic based on shape of supported qubits. So Gate[Tuple[Qubit, Qubit]] would be a two-qubit gate. That lets us be more explicitly typesafe without requiring multiple inheritance. There are some subtleties like ControlledGates, but maybe we could work it out. |
I personally prefer the current structure of checking gate attributes (eg: via Let's merge this PR and discuss the proposal on a separate issue. |
Hey @daxfohl , does |
It shouldn't. Where are you seeing it? |
Oh that's right. Sorry about that. Was confused about something. |
It happens. I just spent half a day trying to figure out why a test framework was rejecting my tests and finally had someone point out that my code wasn't building. :) |
Closes quantumlib#2164 Copies `Two/ThreeQubitGate` to cirq.testing due to its convenience there, and deprecates the originals. BREAKING CHANGE: @balopat @95-martin-orion @tanujkhattar During the deprecation period, `isinstance(TwoQubitGate)` has been shimmed such that it will now return True iff _num_qubits_() returns 2, regardless of whether it's actually part of the class hierarchy (and same for ThreeQubitGate). It's not expected that this will cause real-world breakages, but possible. This can go before or after quantumlib#4236, as they are disjoint problems.
Closes quantumlib#2164 Copies `Two/ThreeQubitGate` to cirq.testing due to its convenience there, and deprecates the originals. BREAKING CHANGE: @balopat @95-martin-orion @tanujkhattar During the deprecation period, `isinstance(TwoQubitGate)` has been shimmed such that it will now return True iff _num_qubits_() returns 2, regardless of whether it's actually part of the class hierarchy (and same for ThreeQubitGate). It's not expected that this will cause real-world breakages, but possible. This can go before or after quantumlib#4236, as they are disjoint problems.
Closes #2164
Copies
Two/ThreeQubitGate
to cirq.testing due to its convenience there, and deprecates the originals.BREAKING CHANGE: @balopat @95-martin-orion @tanujkhattar During the deprecation period,
isinstance(TwoQubitGate)
has been shimmed such that it will now return True iff num_qubits() returns 2, regardless of whether it's actually part of the class hierarchy (and same for ThreeQubitGate). It's not expected that this will cause real-world breakages, but possible.This can go before or after #4236, as they are disjoint problems.