File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change 1313import numpy as np
1414
1515from bqskit .ir .circuit import Circuit
16+ from bqskit .ir .gates .barrier import BarrierPlaceholder
1617from bqskit .ir .gates .constant .swap import SwapGate
1718from bqskit .ir .point import CircuitPoint
1819from bqskit .passes .mapping .sabre import GeneralizedSabreAlgorithm
@@ -175,6 +176,13 @@ def forward_pass( # type: ignore
175176 E = self ._calc_extended_set (circuit , F )
176177 for n in execute_list :
177178 op = circuit [n ]
179+
180+ if isinstance (op .gate , BarrierPlaceholder ):
181+ if modify_circuit :
182+ physical_location = [pi [q ] for q in op .location ]
183+ mapped_circuit .append_gate (op .gate , op .location )
184+ continue
185+
178186 p1 , circ , p2 = self ._get_best_perm (
179187 circuit ,
180188 perm_data [n ],
Original file line number Diff line number Diff line change 99import numpy as np
1010
1111from bqskit .ir .circuit import Circuit
12+ from bqskit .ir .gates .barrier import BarrierPlaceholder
1213from bqskit .ir .gates .circuitgate import CircuitGate
1314from bqskit .ir .gates .constant .swap import SwapGate
1415from bqskit .ir .operation import Operation
@@ -330,6 +331,9 @@ def backward_pass(
330331
331332 def _can_exe (self , op : Operation , pi : list [int ], cg : CouplingGraph ) -> bool :
332333 """Return true if `op` is executable given the current mapping `pi`."""
334+ if isinstance (op .gate , BarrierPlaceholder ):
335+ return True
336+
333337 if isinstance (op .gate , CircuitGate ):
334338 if all (g .num_qudits == 1 for g in op .gate ._circuit .gate_set ):
335339 return True
You can’t perform that action at this time.
0 commit comments