Layout
LogicalLayoutHeuristic
dataclass
LogicalLayoutHeuristic(
arch_spec: ArchSpec = get_arch_spec(),
)
Bases: LayoutHeuristicABC
flowchart TD
bloqade.lanes.heuristics.logical.layout.LogicalLayoutHeuristic[LogicalLayoutHeuristic]
bloqade.lanes.analysis.layout.analysis.LayoutHeuristicABC[LayoutHeuristicABC]
bloqade.lanes.analysis.layout.analysis.LayoutHeuristicABC --> bloqade.lanes.heuristics.logical.layout.LogicalLayoutHeuristic
click bloqade.lanes.heuristics.logical.layout.LogicalLayoutHeuristic href "" "bloqade.lanes.heuristics.logical.layout.LogicalLayoutHeuristic"
click bloqade.lanes.analysis.layout.analysis.LayoutHeuristicABC href "" "bloqade.lanes.analysis.layout.analysis.LayoutHeuristicABC"
compute_layout
compute_layout(
all_qubits: tuple[int, ...],
stages: list[tuple[tuple[int, int], ...]],
pinned: dict[int, LocationAddress] | None = None,
) -> tuple[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. |
required |
pinned
|
dict[int, LocationAddress] | None
|
Map from logical qubit ID to pre-pinned LocationAddress. Implementations MUST place each pinned qubit at its requested address and MUST NOT use any address in pinned.values() for un-pinned qubits. None or empty preserves previous behavior. All values in pinned MUST be valid home positions for the architecture (i.e. present in arch_spec.home_sites); passing an out-of-arch address raises ValueError. |
None
|
Returns:
| Type | Description |
|---|---|
LocationAddress
|
A tuple of LocationAddress objects mapping logical qubit indices |
...
|
to physical locations. Pinned IDs return their pinned address; |
tuple[LocationAddress, ...]
|
un-pinned IDs return the heuristic's choice. Raises if no legal |
tuple[LocationAddress, ...]
|
layout exists. |
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/heuristics/logical/layout.py
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | |
LogicalLayoutHeuristicRecencyWeighted
dataclass
LogicalLayoutHeuristicRecencyWeighted(
arch_spec: ArchSpec = get_arch_spec(),
layout_lookahead_layers: int | None = None,
layout_decay_gamma: float = 0.85,
)
Bases: LogicalLayoutHeuristic
flowchart TD
bloqade.lanes.heuristics.logical.layout.LogicalLayoutHeuristicRecencyWeighted[LogicalLayoutHeuristicRecencyWeighted]
bloqade.lanes.heuristics.logical.layout.LogicalLayoutHeuristic[LogicalLayoutHeuristic]
bloqade.lanes.analysis.layout.analysis.LayoutHeuristicABC[LayoutHeuristicABC]
bloqade.lanes.heuristics.logical.layout.LogicalLayoutHeuristic --> bloqade.lanes.heuristics.logical.layout.LogicalLayoutHeuristicRecencyWeighted
bloqade.lanes.analysis.layout.analysis.LayoutHeuristicABC --> bloqade.lanes.heuristics.logical.layout.LogicalLayoutHeuristic
click bloqade.lanes.heuristics.logical.layout.LogicalLayoutHeuristicRecencyWeighted href "" "bloqade.lanes.heuristics.logical.layout.LogicalLayoutHeuristicRecencyWeighted"
click bloqade.lanes.heuristics.logical.layout.LogicalLayoutHeuristic href "" "bloqade.lanes.heuristics.logical.layout.LogicalLayoutHeuristic"
click bloqade.lanes.analysis.layout.analysis.LayoutHeuristicABC href "" "bloqade.lanes.analysis.layout.analysis.LayoutHeuristicABC"
compute_layout
compute_layout(
all_qubits: tuple[int, ...],
stages: list[tuple[tuple[int, int], ...]],
pinned: dict[int, LocationAddress] | None = None,
) -> tuple[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. |
required |
pinned
|
dict[int, LocationAddress] | None
|
Map from logical qubit ID to pre-pinned LocationAddress. Implementations MUST place each pinned qubit at its requested address and MUST NOT use any address in pinned.values() for un-pinned qubits. None or empty preserves previous behavior. All values in pinned MUST be valid home positions for the architecture (i.e. present in arch_spec.home_sites); passing an out-of-arch address raises ValueError. |
None
|
Returns:
| Type | Description |
|---|---|
LocationAddress
|
A tuple of LocationAddress objects mapping logical qubit indices |
...
|
to physical locations. Pinned IDs return their pinned address; |
tuple[LocationAddress, ...]
|
un-pinned IDs return the heuristic's choice. Raises if no legal |
tuple[LocationAddress, ...]
|
layout exists. |
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/heuristics/logical/layout.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | |