From 01531032001e9ef5a7274f27de96e56d77046eb1 Mon Sep 17 00:00:00 2001 From: changsookim <> Date: Mon, 18 Nov 2024 09:59:54 +0400 Subject: [PATCH] convert wire names execute() --- src/qibo/models/circuit.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/qibo/models/circuit.py b/src/qibo/models/circuit.py index e0a0689655..f838ef26d5 100644 --- a/src/qibo/models/circuit.py +++ b/src/qibo/models/circuit.py @@ -1110,8 +1110,19 @@ def execute(self, initial_state=None, nshots=1000): backend = _Global.backend() transpiler = _Global.transpiler() + + if backend.qubits is not None: + node_mapping = {q: i for i, q in enumerate(backend.qubits)} + self.wire_names = [node_mapping[q] for q in self.wire_names] + transpiled_circuit, _ = transpiler(self) # pylint: disable=E1102 + if backend.qubits is not None: + self.wire_names = [ + list(node_mapping)[list(node_mapping.values()).index(q)] + for q in self.wire_names + ] + if self.accelerators: # pragma: no cover return backend.execute_distributed_circuit( transpiled_circuit, initial_state, nshots