From 8dfe530a660d60dd550eb04592cefbc10c5f9c50 Mon Sep 17 00:00:00 2001 From: positr0nium Date: Thu, 1 Feb 2024 11:10:13 +0100 Subject: [PATCH] fixed a bug that prevented circuit execution on virtual qiskit backends for some backends --- setup.cfg | 2 +- src/qrisp/interface/backends.py | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/setup.cfg b/setup.cfg index 179e4216..0b881ea7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = qrisp -version = 0.4.2 +version = 0.4.3 author = Raphael Seidel author_email = raphael.seidel@fokus.fraunhofer.de description = A high-level quantum programming language diff --git a/src/qrisp/interface/backends.py b/src/qrisp/interface/backends.py index a3e5dc35..3caa7ab3 100644 --- a/src/qrisp/interface/backends.py +++ b/src/qrisp/interface/backends.py @@ -169,9 +169,16 @@ def run(qasm_str, shots, token = ""): qiskit_qc = QuantumCircuit.from_qasm_str(qasm_str) - from qiskit import transpile + + #Make circuit with one monolithic register + new_qiskit_qc = QuantumCircuit(len(qiskit_qc.qubits), len(qiskit_qc.clbits)) + for instr in qiskit_qc: + new_qiskit_qc.append(instr.operation, + [qiskit_qc.qubits.index(qb) for qb in instr.qubits], + [qiskit_qc.clbits.index(cb) for cb in instr.clbits]) - qiskit_qc = transpile(qiskit_qc, backend=backend) + from qiskit import transpile + qiskit_qc = transpile(new_qiskit_qc, backend=backend) # Run Circuit on the Qiskit backend qiskit_result = backend.run(qiskit_qc, shots=shots).result().get_counts() # Remove the spaces in the qiskit result keys