Closed csookim closed 3 months ago
self._temporary_added_swaps: int
self._saved_circuit: CircuitMap
self._temp_added_swaps: list
Before update: 0.558s After update: 0.253s
CircuitMap.update()
. Would it be better to create a new function undo()
for this purpose?TranspilerPipelineError
is raised when the gate to be undone doesn't match the last added SWAP gate. Is there a more suitable error type for this situation?Thank you for this work, the code looks nice. Regarding the two points you asked in the discussion:
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 99.94%. Comparing base (
3d87ba7
) to head (96a0bd8
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
@Simone-Bordoni , I have a question about the def test_circuit_map()
function.
The function includes the following code:
...
initial_layout = {"q0": 2, "q1": 0, "q2": 1, "q3": 3}
...
circuit_map.update((0, 2)) # first swap
...
circuit_map.update((1, 2)) # second swap
assert routed_circuit.queue[5].qubits == (2, 0) # routed_circuit.queue[5] is the second swap
After the first swap, the layout should be converted to:
{"q0": 0, "q1": 2, "q2": 1, "q3": 3}
since update()
operates on logical qubits. This would be equivalent to swapping physical qubits q0 and q1.
After the second swap, the swap should be on logical qubits (1, 2). So, the layout will be changed to:
{"q0": 0, "q1": 1, "q2": 2, "q3": 3}
Does this mean that the qubits affected by the swap are q2 and q1?
assert routed_circuit.queue[5].qubits == (2, 1)
Since routed_circuit.queue[i].qubits
contains physical qubits, I think the qubits should be (2, 1). Could you help me understand if there's something I’m misunderstanding here?
Thank you for your time.
This PR is an addition to #1398.
Since
deepcopy()
makes the compiler slower, it needs to be changed.code
Line 901 takes over 30% of the routing time.
Checklist: