Skip to content

Physical layout

PhysicalLayoutHeuristicGraphPartitionCenterOut dataclass

PhysicalLayoutHeuristicGraphPartitionCenterOut(
    arch_spec: ArchSpec = get_physical_arch_spec(),
    max_words: int | None = None,
    u_factor: int = 1,
    partitioner_seed: int = 0,
)

Bases: LayoutHeuristicABC

compute_layout

compute_layout(
    all_qubits: tuple[int, ...],
    stages: list[tuple[tuple[int, int], ...]],
) -> tuple[layout.LocationAddress, ...]

Compute the initial qubit layout from circuit stages.

Parameters:

Name Type Description Default
all_qubits tuple[int, ...]

Tuple of logical qubit indices to be mapped.

required
stages list[tuple[tuple[int, int], ...]]

List of circuit stages, where each stage is a tuple of (control, target) qubit pairs representing two-qubit gates. For example: [ ((control1, target1), (control2, target2)), # stage 1 ((control3, target3),), # stage 2 ... ]

required

Returns:

Type Description
tuple[LocationAddress, ...]

A tuple of LocationAddress objects mapping logical qubit indices to physical locations.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/heuristics/physical_layout.py
307
308
309
310
311
312
313
314
def compute_layout(
    self,
    all_qubits: tuple[int, ...],
    stages: list[tuple[tuple[int, int], ...]],
) -> tuple[layout.LocationAddress, ...]:
    qubits = tuple(sorted(all_qubits))
    cz_layers = _to_cz_layers(stages)
    return self._compute_layout_from_cz_layers(qubits, cz_layers)