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
enable controlled opaque gates. #3950
Conversation
I think this doesn't correctly fix #3565, or at least the example I tried: from qiskit import transpile, QuantumCircuit
from qiskit.circuit import Gate
basis_gates = ['u1', 'u3', 'cx']
gate = Gate('my_gate', 1, [])
gate._definition = []
circuit = QuantumCircuit(2)
circuit.append(gate.control(), [0, 1], [])
transpile(circuit, basis_gates=basis_gates) still resolves in
@ewinston Are you actively working on this? In a few test cases for arithmetic circuits for the circuit library I had the case that I'm controlling empty gates. I could work around there by checking first if the definition is empty, but if this is on the way to be merged I can avoid that 🙂 |
@Cryoris This seems to be due to the transpiler expecting opaque gates to have an empty list for |
@ewinston can you update this branch? |
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.
merge master
6576014
to
b563548
Compare
Is this still active? I'm thinking this has been superseded by the |
Given the above comment, and the |
Summary
Previously attempting to create a controlled gate from an opaque gate would raise an error as described in #3565. This pr returns an opaque controlled gate for opaque gates.
fixes #3565
fixes #4010
Details and comments
This pr allows the identity gate to be controlled to handle controlled composite gates which contain the gate. The control operation applies identity gates to the controls as well.