-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Implementing the bridge gate. #6718
base: main
Are you sure you want to change the base?
Conversation
Added a new gate which is the bridge gate, it is named brg
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 @Djakam , this looks great so far! A few minor comments below.
for instr, qargs, cargs in rules: | ||
qc._append(instr, qargs, cargs) | ||
|
||
self.definition = qc |
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.
If you know the __array__
representation, it would be good to add this as a case to TestGateDefinitions
in test/python/circuit/test_gate_definitions.py
(and even if not, it can be added to TestStandardGates.test_definition_parameters
in the same file to ensure the definition and equivalence library entires remain in sync).
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, @kdk. I will change the code accordingly before pushing it again.
Added a new gate which is the bridge gate, it is named brg
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 the updates here @Djakam , this looks great! The lass piece will be to expand the gate name from brg
to bridge
(and likewise for the class name).
@ajavadia , thanks for your input. What could be the name for the 4 qubits? what about the 5 ? Any propositions? |
I'm just trying to make this a bit more general than this very specific use case. I'm certainly not suggesting making a 3, 4, 5, qubit version of this gate. So the Bridge gate implemented thus far in your PR is a synthesis of a CNOT on 2 qubits separated by one qubit, on a line. The more general thing is you want to synthesize a CNOT on 2 qubits that are distant on some coupling_map. I think there are algorithms that can do this efficiently for the general case, and give you the bridge gate for this specific case. On the other hand if you want to do the circuit optimization suggested in #6656, then I think a better approach is to use the template optimizations in Qiskit. Just define a template and the template optimization pass will do it, no need to write a separate pass. |
from qiskit.exceptions import QiskitError | ||
|
||
|
||
class BridgeGate(QuantumCircuit): |
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.
Why does this inherit from QuantumCircuit
instead of Gate
?
Added a new gate which is the bridge gate, it is named brg
Summary
Details and comments