-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Add rust representation for SGates, TGates, and iSwap gate #12598
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
Add missing gate definitions that depended on these gates (marked as todo).
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.
The other thing you probably want to update here is adding the fast path for rust gates to the circuit methods. For example:
qiskit/qiskit/circuit/quantumcircuit.py
Lines 4481 to 4492 in 6d6dce3
def h(self, qubit: QubitSpecifier) -> InstructionSet: | |
"""Apply :class:`~qiskit.circuit.library.HGate`. | |
For the full matrix form of this gate, see the underlying gate documentation. | |
Args: | |
qubit: The qubit(s) to apply the gate to. | |
Returns: | |
A handle to the instructions created. | |
""" | |
return self._append_standard_gate(StandardGate.HGate, [], qargs=[qubit]) |
Pull Request Test Coverage Report for Build 9568639056Details
💛 - Coveralls |
Pull Request Test Coverage Report for Build 9569020887Details
💛 - 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, thanks for tackling these.
(Self::TGate, smallvec![], q2.clone()), | ||
(Self::HGate, smallvec![], q2), | ||
(Self::CXGate, smallvec![], q0_1.clone()), | ||
(Self::TGate, smallvec![], smallvec![Qubit(0)]), |
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.
No variable for this one? :)
Summary
This PR adds some of the remaining gates from #12566. The changes are related to #12572, which adds u1, u2 and u3, and #12507, which adds the RGate.
I am tempted to modify the order of the gate table to something a bit nicer but with so many open parallel PRs that modify it I think it would be a source of bugs, and it might make more sense to leave it for later.
Details and comments