-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Gate instances (without a definition) are not qasm2-exported as opaque
#5036
Comments
Custom gates should be |
So does the functionality to create a circuit with custom gates from a qasm string exist? |
In QASM, you can declare a custom opaque gate using the
or a non-opaque gate using the
In your example, you are defining a python I did find a related bug in that user-defined
|
Yes that's the issue I'm having Kevin - thanks. |
@kdk 's example:
does not work because |
opaque
Indeed. Renaming the issue. @kdk says:
|
opaque
opaque
Information
What is the current behavior?
Parsing a qasm string including a custom gate definiton - as given by Gate.qasm() - using QuantumCircuit.from_qasm_str() returns QasmError: "Cannot find gate definition for 'test', line 6 file ".
This issue was reported in #3066, which was closed, but the issue persists.
Steps to reproduce the problem
from qiskit.circuit import Gate
from qiskit.circuit import QuantumCircuit
test_gate = Gate('test',num_qubits=1,params=[])
test_qasm = 'OPENQASM 2.0;\ninclude "qelib1.inc";\n\nqreg q[2];\ncreg cr[2];\ntest q[0];\n'
test_circ = QuantumCircuit.from_qasm_str(test_qasm)
What is the expected behavior?
Generate quantum circuit with custom gate without throwing error.
Suggested solutions
The text was updated successfully, but these errors were encountered: