Skip to content

Commit

Permalink
change test files
Browse files Browse the repository at this point in the history
  • Loading branch information
peachnuts committed Jan 24, 2024
1 parent ec243a4 commit 7f390e1
Show file tree
Hide file tree
Showing 6 changed files with 84,077 additions and 14 deletions.
37 changes: 24 additions & 13 deletions bqskit/passes/partitioning/quick.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,25 @@ def process_pending_bins() -> None:

# Merge previously placed blocks if possible
merging = not isinstance(
bin, (BarrierBin, MeasurementBin, ResetBin),
bin, (
BarrierBin,
MeasurementBin,
ResetBin,
),
)
while merging:
merging = False
for p in partitioned_circuit.rear:
op = partitioned_circuit[p]
if isinstance(op.gate, (BarrierPlaceholder, MeasurementPlaceholder, Reset)):
# Don't merge through barriers
if isinstance(
op.gate, (
BarrierPlaceholder,
MeasurementPlaceholder,
Reset,
),
):
# Don't merge through barriers,
# measurement, or reset
continue
qudits = list(op.location)

Expand Down Expand Up @@ -157,7 +168,11 @@ def process_pending_bins() -> None:
subc,
loc,
not isinstance(
bin, (BarrierBin, MeasurementBin, ResetBin),
bin, (
BarrierBin,
MeasurementBin,
ResetBin,
),
),
True,
)
Expand Down Expand Up @@ -428,18 +443,15 @@ def __init__(
# Add the measurement
self.add_op(point, location)

# Barriar bins fill the volume to the next gates
# Measurement bins fill the volume to the next gates

nexts = circuit.next(point)
ends: dict[int, int | None] = {q: None for q in location}
for p in nexts:
loc = circuit[p].location
for q in loc:
if q in ends and (
ends[q] is None or ends[q] >= p.cycle
): # type: ignore # noqa # short-circuit safety for >=
if q in ends and (ends[q] is None or ends[q] >= p.cycle): # type: ignore # noqa # short-circuit safety for >=
ends[q] = p.cycle - 1

self.ends = ends

# Close the bin
Expand All @@ -462,18 +474,17 @@ def __init__(
# Add the reset
self.add_op(point, location)

# Barriar bins fill the volume to the next gates
# Reset bins fill the volume to the next gates

nexts = circuit.next(point)
ends: dict[int, int | None] = {q: None for q in location}
for p in nexts:
loc = circuit[p].location
for q in loc:
if q in ends and (
ends[q] is None or ends[q] >= p.cycle
): # type: ignore # noqa # short-circuit safety for >=
ends[q] is None or ends[q] >= p.cycle # type: ignore # noqa # short-circuit safety for >=
):
ends[q] = p.cycle - 1

self.ends = ends

# Close the bin
Expand Down
Loading

0 comments on commit 7f390e1

Please sign in to comment.