Closed ArfatSalman closed 1 year ago
{'qiskit-terra': '0.23.1', 'qiskit-aer': '0.11.2', 'qiskit-ignis': None, 'qiskit-ibmq-provider': '0.20.0', 'qiskit': '0.41.0', 'qiskit-nature': None, 'qiskit-finance': None, 'qiskit-optimization': None, 'qiskit-machine-learning': None}
Exporting and importing the same circuit in QASM3 throws '6,7: type error'.
'6,7: type error'
from qiskit import transpile from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister from qiskit.circuit.library.standard_gates import * qr = QuantumRegister(3, name="qr") cr = ClassicalRegister(3, name="cr") qc = QuantumCircuit(qr, cr, name="qc") qc.append(XGate(), qargs=[qr[2]], cargs=[]) qc.append(SGate(), qargs=[qr[2]], cargs=[]) qc.measure(qr, cr) qc = transpile(qc) # if this line is commented out, there's no error then from qiskit.qasm3 import loads, dumps qc = loads(dumps(qc)) # qiskit_qasm3_import.exceptions.ConversionError: 6,7: type error # qiskit.qasm3.exceptions.QASM3ImporterError: '6,7: type error'
Using QASM2 round-trip (qc.from_qasm_str(qc.qasm())) works for the above circuit. I was expecting the QASM3 roundtrip to work as well.
qc.from_qasm_str(qc.qasm())
No response
Thanks - this is a bug in the implicit-cast typing resolution of the importer; it's missing a rule to unify int * float, which is what's needed here.
int * float
Environment
{'qiskit-terra': '0.23.1', 'qiskit-aer': '0.11.2', 'qiskit-ignis': None, 'qiskit-ibmq-provider': '0.20.0', 'qiskit': '0.41.0', 'qiskit-nature': None, 'qiskit-finance': None, 'qiskit-optimization': None, 'qiskit-machine-learning': None}
What is happening?
Exporting and importing the same circuit in QASM3 throws
'6,7: type error'
.How can we reproduce the issue?
What should happen?
Using QASM2 round-trip (
qc.from_qasm_str(qc.qasm())
) works for the above circuit. I was expecting the QASM3 roundtrip to work as well.Any suggestions?
No response