Skip to content

Commit

Permalink
convert wire names execute()
Browse files Browse the repository at this point in the history
  • Loading branch information
changsookim committed Nov 18, 2024
1 parent cbc0c2f commit 0153103
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/qibo/models/circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0153103

Please sign in to comment.