Skip to content

Simple layout

PhysicalLayoutHeuristicFixed dataclass

PhysicalLayoutHeuristicFixed(
    arch_spec: ArchSpec = get_physical_arch_spec(),
)

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/simple_layout.py
16
17
18
19
20
21
22
23
24
25
26
27
def compute_layout(
    self,
    all_qubits: tuple[int, ...],
    stages: list[tuple[tuple[int, int], ...]],
) -> tuple[layout.LocationAddress, ...]:
    _ = stages
    qubits = tuple(sorted(all_qubits))
    sites: list[layout.LocationAddress] = []
    for word_id in range(len(self.arch_spec.words)):
        for site_id in range(self.left_site_count):
            sites.append(layout.LocationAddress(word_id, site_id))
    return tuple(sites[: len(qubits)])