Index
AllToAllSiteTopology
dataclass
AllToAllSiteTopology()
All-to-all site connectivity: one bus per (src, dst) pair.
For N sites, produces N*(N-1)/2 single-element buses allowing any site to reach any other site directly.
ArchBlueprint
dataclass
ArchBlueprint(
zones: dict[str, ZoneSpec],
layout: DeviceLayout = DeviceLayout(),
feed_forward: bool = False,
atom_reloading: bool = False,
blockade_radius: float | None = None,
)
High-level architecture definition composed of named zones and layout.
Zones are ordered by insertion order of the zones dict, which
determines word ID assignment (contiguous per zone) and vertical
layout (top to bottom).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
zones
|
dict[str, ZoneSpec]
|
Named zones with their specifications. |
required |
layout
|
DeviceLayout
|
Physical layout parameters for word/site placement. |
DeviceLayout()
|
feed_forward
|
bool
|
Whether the device supports feed-forward operations. |
False
|
atom_reloading
|
bool
|
Whether the device supports atom reloading. |
False
|
blockade_radius
|
float | None
|
Rydberg blockade radius (µm) to record on the
ArchSpec. When set, this value is passed directly to
|
None
|
total_words
property
total_words: int
Total number of words across all zones.
words_per_zone
property
words_per_zone: int
Number of words per zone (all zones have equal grid dimensions).
zone_names
property
zone_names: tuple[str, ...]
Zone names in definition order.
ArchBuilder
ArchBuilder()
Compose ZoneBuilders into a complete ArchSpec.
Each zone added gets assigned global word IDs. Inter-zone connections
go into zone_buses. Calls Rust validation on build().
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/build/imperative.py
1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 | |
blockade_radius
property
blockade_radius: float | None
Rydberg blockade radius (µm) applied to all zones, or None.
add_mode
add_mode(name: str, zones: Sequence[str]) -> None
Add an operational mode.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Mode name (e.g. "all", "gate", "measure"). |
required |
zones
|
Sequence[str]
|
Zone names to include in this mode. |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/build/imperative.py
1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 | |
add_zone
add_zone(zone: ZoneBuilder) -> int
Add a zone. Returns zone_id. Assigns global word IDs.
Validates that sites_per_word matches across all zones.
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/build/imperative.py
1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 | |
build
build(
feed_forward: bool = False,
atom_reloading: bool = False,
blockade_radius: float | None = None,
) -> ArchSpec
Assemble the ArchSpec and validate via Rust.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
feed_forward
|
bool
|
Whether the device supports feed-forward. |
False
|
atom_reloading
|
bool
|
Whether the device supports atom reloading. |
False
|
blockade_radius
|
float | None
|
Explicit blockade radius (µm). If provided, overrides both builder-level and zone-level radii. |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If Rust validation fails. |
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/build/imperative.py
1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 | |
connect
connect(
src: tuple[str, Sequence[int]],
dst: tuple[str, Sequence[int]],
) -> None
Add an inter-zone bus (zone_buses).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
src
|
tuple[str, Sequence[int]]
|
|
required |
dst
|
tuple[str, Sequence[int]]
|
|
required |
Validates AOD Cartesian product across the two zone grids.
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/build/imperative.py
1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 | |
set_blockade_radius
set_blockade_radius(radius: float) -> None
Apply radius to every zone by calling
:meth:ZoneBuilder.set_blockade_radius on each.
Overwrites every zone's entangling pairs with the scan result.
The radius is stored on the builder and flows to
ArchSpec.blockade_radius at :meth:build time.
The radius is validated up-front (positive, finite, nm-precise) before any zone is touched, and the scan is run two-phase: every zone is scanned before any pair list is overwritten, so a layout error in a later zone cannot leave earlier zones in a partially-updated state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
radius
|
float
|
Rydberg blockade radius in micrometers. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
if |
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/build/imperative.py
1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 | |
ArchResult
dataclass
ArchResult(
arch: ArchSpec,
zone_grids: dict[str, WordGrid],
zone_indices: dict[str, int],
)
Result of build_arch(), containing the ArchSpec and metadata.
ArchSpec
ArchSpec(inner: ArchSpec)
Bases: RustWrapper[ArchSpec]
flowchart TD
bloqade.lanes.arch.ArchSpec[ArchSpec]
bloqade.lanes.bytecode._wrapper.RustWrapper[RustWrapper]
bloqade.lanes.bytecode._wrapper.RustWrapper --> bloqade.lanes.arch.ArchSpec
click bloqade.lanes.arch.ArchSpec href "" "bloqade.lanes.arch.ArchSpec"
click bloqade.lanes.bytecode._wrapper.RustWrapper href "" "bloqade.lanes.bytecode._wrapper.RustWrapper"
Architecture specification for a quantum device.
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/spec.py
36 37 38 | |
atom_reloading
property
atom_reloading: bool
Whether the device supports reloading atoms after initial fill.
blockade_radius
property
blockade_radius: float | None
Rydberg blockade radius (µm), or None if not provided.
This is metadata — when present, it indicates the radius
associated with the architecture and is typically used to
interpret the entangling pairs. It is not independently
verified at the ArchSpec level; use
:meth:ZoneBuilder.set_blockade_radius /
:meth:ArchBuilder.set_blockade_radius if you want the pair
list to be derived from and checked against a radius.
cz_zone_addresses
cached
property
cz_zone_addresses: frozenset[ZoneAddress]
Zones that host CZ entangling operations (have entangling_pairs).
feed_forward
property
feed_forward: bool
Whether the device supports mid-circuit measurement with classical feedback.
home_sites
cached
property
home_sites: frozenset[LocationAddress]
All home LocationAddresses with correct zone_id per word.
A home site is (zone_id, word_id, site_id) where word_id is
a home word (lower word_id in each entangling pair, or unpaired)
and zone_id is the zone that word belongs to.
max_qubits
property
max_qubits: int
Get the maximum number of qubits supported by this architecture.
paths
cached
property
paths: MappingProxyType[
LaneAddress, tuple[tuple[float, float], ...]
]
Transport path waypoints keyed by LaneAddress.
Derived from the Rust ArchSpec.paths on first access.
site_buses
cached
property
site_buses: tuple[SiteBus, ...]
Aggregate all site buses across all zones.
Note: indices in this flat list do NOT correspond to per-zone
bus_id values in LaneAddress. Prefer iterating zones directly
via self.zones[i].site_buses.
sites_per_word
property
sites_per_word: int
Get the number of sites per word.
word_buses
cached
property
word_buses: tuple[WordBus, ...]
Aggregate all word buses across all zones.
Note: indices in this flat list do NOT correspond to per-zone
bus_id values in LaneAddress. Prefer iterating zones directly
via self.zones[i].word_buses.
word_zone_map
cached
property
word_zone_map: dict[int, int]
Map each word_id to the zone_id it belongs to.
Delegates to Rust ArchSpec.word_zone_map().
words
cached
property
words: tuple[Word, ...]
Python Word wrappers, derived from the Rust ArchSpec.
check_lane_group
check_lane_group(
lanes: Sequence[LaneAddress],
) -> Sequence[LaneGroupError]
Validate a group of lane addresses via Rust.
Checks individual lane validity, group consistency (direction, bus_id, move_type), bus membership, and AOD geometry constraints. Returns a list of LaneGroupError exceptions (empty if all valid).
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/spec.py
362 363 364 365 366 367 368 369 370 371 372 | |
check_location_group
check_location_group(
locations: Sequence[LocationAddress],
) -> Sequence[LocationGroupError]
Validate a group of location addresses via Rust.
Returns a list of LocationGroupError exceptions (empty if all valid).
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/spec.py
352 353 354 355 356 357 358 359 360 | |
from_components
classmethod
from_components(
words: tuple[Word, ...],
zones: tuple[Zone, ...],
modes: Sequence[Mode],
zone_buses: Sequence[ZoneBus] = (),
paths: (
dict[LaneAddress, tuple[tuple[float, float], ...]]
| None
) = None,
feed_forward: bool = False,
atom_reloading: bool = False,
blockade_radius: float | None = None,
) -> ArchSpec
Construct an ArchSpec from Python component types.
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/spec.py
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | |
get_cz_partner
get_cz_partner(
location: LocationAddress,
) -> LocationAddress | None
Get the CZ partner for a given location.
Uses Rust-side get_cz_partner which resolves via the zone's entangling_pairs.
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/spec.py
414 415 416 417 418 419 420 421 422 423 | |
get_lane_address
get_lane_address(
src: LocationAddress, dst: LocationAddress
) -> LaneAddress | None
Given an input tuple of locations, gets the lane (w/direction).
Delegates to Rust ArchSpec.lane_for_endpoints().
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/spec.py
374 375 376 377 378 379 380 381 382 383 384 | |
get_zone_index
get_zone_index(
loc_addr: LocationAddress, zone_id: ZoneAddress
) -> int | None
O(1) flat index of a location within a zone.
Delegates to Rust ArchSpec.zone_location_index().
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/spec.py
318 319 320 321 322 323 324 325 326 327 | |
is_home_position
is_home_position(addr: LocationAddress) -> bool
True if this address is at a home (non-CZ-staging) word.
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/spec.py
125 126 127 | |
iter_all_lanes
iter_all_lanes() -> Iterator[LaneAddress]
Yield every valid lane address in the architecture.
Enumerates site-bus, word-bus, and zone-bus lanes in both forward
and backward directions. Used by
:class:~bloqade.lanes.arch.metrics.MoveMetricCalculator to compute
max-duration bounds. Prefer get_lane_address(src, dst) for
single-pair lookups.
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/spec.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | |
to_json
to_json() -> str
Serialize this architecture spec to a JSON string.
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/spec.py
262 263 264 | |
try_get_endpoints
try_get_endpoints(
lane_address: LaneAddress,
) -> tuple[LocationAddress, LocationAddress] | None
Resolve lane_address to its (src, dst) location pair, or
None when the lane is not a valid lane in the architecture
(matches the Rust lane_endpoints contract).
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/spec.py
398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 | |
try_get_position
try_get_position(
location: LocationAddress,
) -> tuple[float, float] | None
Resolve location to its physical (x, y) position, or
None when location doesn't correspond to a valid site
under the zone its zone_id selects (matches the Rust
location_position contract).
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/spec.py
344 345 346 347 348 349 350 | |
yield_zone_locations
yield_zone_locations(
zone_address: ZoneAddress,
) -> Iterator[LocationAddress]
Yield LocationAddresses in the canonical zone-bitstring iteration order.
This is the layout that get_zone_index(loc, zone_address)
numbers: every (word, site) pair in the architecture, tagged
with zone_address, walked in word-major then site-major order.
The iterator visits every word — zone_address is the tag
stamped onto each yielded address (and the grid through which
downstream calls like get_position interpret it), not a
membership filter.
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/spec.py
277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | |
ArchSpecGeometry
ArchSpecGeometry(arch_spec: 'ArchSpec | _RustArchSpec')
Geometry-level query helper wrapping an ArchSpec.
Provides methods for retrieving coordinate grids, flat site lists, and bus descriptors from an architecture specification. Intended for downstream consumers who need geometry-level data without walking Rust zone objects directly.
Accepts either a Python :class:~bloqade.lanes.arch.spec.ArchSpec or a
raw Rust _RustArchSpec object, so it can be constructed from either
layer of the stack.
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/geometry.py
49 50 51 52 53 | |
get_all_sites
get_all_sites() -> list[tuple[float, float]]
Get all site positions across all zones in canonical order.
Returns positions in zone-major order, with each zone flattened
in column-major grid order (x outer, y inner).
Each position is an (x, y) tuple.
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/geometry.py
79 80 81 82 83 84 85 86 87 88 89 90 91 | |
get_available_buses
get_available_buses(zone_id: int) -> list[BusDescriptor]
Enumerate all valid bus descriptors for a zone.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
zone_id
|
int
|
Zone index. |
required |
Returns:
| Type | Description |
|---|---|
list[BusDescriptor]
|
List of |
list[BusDescriptor]
|
combination that has at least one lane in this zone. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If zone_id is out of range. |
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/geometry.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | |
get_grid_endpoints
get_grid_endpoints(
zone_id: int,
bus_id: int,
move_type: MoveType,
direction: Direction,
) -> tuple[GeoGrid, GeoGrid]
Get start and end grids for a bus move at full occupancy.
Returns two bloqade.geometry.Grid objects representing the
source and destination positions for all lanes in the specified
bus group.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
zone_id
|
int
|
Zone index. |
required |
bus_id
|
int
|
Bus index within the zone. |
required |
move_type
|
MoveType
|
SITE or WORD. |
required |
direction
|
Direction
|
FORWARD or BACKWARD. |
required |
Returns:
| Type | Description |
|---|---|
Grid
|
|
Grid
|
positions of all source/destination sites for this bus. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If zone_id or bus_id is out of range, or move_type is not SITE or WORD. |
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/geometry.py
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | |
get_zone_grid
get_zone_grid(zone_id: int) -> GeoGrid
Get the coordinate grid for a zone as a bloqade.geometry.Grid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
zone_id
|
int
|
Zone index. |
required |
Returns:
| Type | Description |
|---|---|
Grid
|
A |
Grid
|
x and y positions. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If zone_id is out of range. |
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/geometry.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | |
BusDescriptor
dataclass
BusDescriptor(
bus_id: int,
move_type: MoveType,
direction: Direction,
num_lanes: int,
)
Descriptor for a bus within a zone.
DeviceLayout
dataclass
DeviceLayout(
sites_per_word: int = 5,
site_spacing: float = 10.0,
pair_spacing: float = 10.0,
row_spacing: float = 20.0,
zone_gap: float = 20.0,
x_clearance: float = 3.0,
y_clearance: float = 3.0,
)
Physical layout parameters for word and site placement.
Words are horizontal rows with interleaved CZ pairs. Within a pair, sites alternate: even word at x=0, 2s, 4s, ... and odd word at x=s, 3s, 5s, ... where s = site_spacing (blockade radius).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sites_per_word
|
int
|
Number of sites per word. |
5
|
site_spacing
|
float
|
Distance between adjacent atoms (micrometers). Also determines the CZ blockade distance between paired sites. |
10.0
|
pair_spacing
|
float
|
Horizontal gap between adjacent CZ pairs (micrometers). |
10.0
|
row_spacing
|
float
|
Vertical distance between word grid rows (micrometers). |
20.0
|
zone_gap
|
float
|
Additional vertical gap between zones (micrometers). |
20.0
|
x_clearance
|
float
|
Minimum x-axis clearance (µm) between AOD path waypoints and grid lines. |
3.0
|
y_clearance
|
float
|
Minimum y-axis clearance (µm) between AOD path waypoints and grid lines. Separate x/y values are useful when row and column spacings differ substantially. |
3.0
|
DiagonalWordTopology
dataclass
DiagonalWordTopology()
Diagonal word connectivity between adjacent column pairs.
For a grid of (N rows x C cols), applies diagonal connectivity between each adjacent column pair (col_i, col_{i+1}). Per pair, produces 2N - 1 buses. Total buses: (C-1) * (2N - 1).
Per column pair: - Group 1 (shift 0..N-1): col_a[r] -> col_b[r + shift] for r in 0..N-1-shift - Group 2 (shift 1..N-1): col_a[r + shift] -> col_b[r] for r in 0..N-1-shift (reverse diagonal)
This gives full connectivity between all word pairs in adjacent columns, organized by diagonal. Non-adjacent columns are reachable via multi-hop.
HypercubeSiteTopology
dataclass
HypercubeSiteTopology()
Hypercube site connectivity within a single word.
For N = 2^k sites, produces k buses. Bus for dimension d connects sites that differ in bit d: src = [sites with bit d=0], dst = [sites with bit d=1]. Each bus has N/2 parallel moves.
For non-power-of-2 N, rounds up to the next power of 2 and filters out site indices >= N. Higher-indexed sites get fewer connections (e.g. for N=17, site 16 connects only to site 0 via dimension 4).
HypercubeWordTopology
dataclass
HypercubeWordTopology()
Hypercube word connectivity along both row and column dimensions.
For a grid of (R x C) words where R = 2^r and C = 2^c, produces r + c buses. Row dimension d connects word(row, col) to word(row ^ 2^d, col). Column dimension d connects word(row, col) to word(row, col ^ 2^d).
InterZoneTopology
Bases: Protocol
flowchart TD
bloqade.lanes.arch.InterZoneTopology[InterZoneTopology]
click bloqade.lanes.arch.InterZoneTopology href "" "bloqade.lanes.arch.InterZoneTopology"
Generates word buses connecting words across two zones.
MatchingTopology
dataclass
MatchingTopology()
1:1 matching of words by grid position across two zones.
Produces a single bus pairing grid_a(r, c) with grid_b(r, c) for all (r, c). Requires both grids to have the same dimensions.
MoveMetricCalculator
dataclass
MoveMetricCalculator(arch_spec: Any)
Move-metric computation: lane durations, distances, and costs.
Owns timing constants extracted from bloqade-flair and provides
cached lane duration / cost lookups. Lives in the layout
package so that PathFinder and heuristics can consume it
without pulling in the heavy compilation imports of Metrics.
get_lane_duration_cost
get_lane_duration_cost(
lane_address: Any, *, amplitude_delta: float = 1.0
) -> float
Return normalized lane duration cost in [0, 1].
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/metrics.py
94 95 96 97 98 99 100 101 102 103 104 | |
get_lane_duration_us
get_lane_duration_us(
lane_address: Any, *, amplitude_delta: float = 1.0
) -> float
Return lane execution duration in microseconds.
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/metrics.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | |
lane_distance_um
lane_distance_um(lane: Any) -> float
Total distance in µm along a lane's path.
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/metrics.py
106 107 108 109 | |
PathFinder
dataclass
PathFinder(spec: ArchSpec)
physical_address_map
class-attribute
instance-attribute
physical_address_map: dict[LocationAddress, int] = field(
init=False, default_factory=dict
)
Map from (zone_id, word_id, site_id) tuple to graph node index.
physical_addresses
class-attribute
instance-attribute
physical_addresses: list[LocationAddress] = field(
init=False, default_factory=list
)
Map from graph node index to (zone_id, word_id, site_id) tuple.
site_graph
class-attribute
instance-attribute
site_graph: PyDiGraph = field(
init=False, default_factory=PyDiGraph
)
Graph representing all sites and edges as lanes.
extract_lanes_from_path
extract_lanes_from_path(
path: list[int],
) -> tuple[LaneAddress, ...]
Given a path as node indices, extract the lane addresses.
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/path.py
132 133 134 135 136 137 138 139 140 141 142 143 144 | |
extract_locations_from_path
extract_locations_from_path(
path: list[int],
) -> tuple[LocationAddress, ...]
Given a path as node indices, extract the location addresses.
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/path.py
146 147 148 149 150 | |
find_path
find_path(
start: LocationAddress,
end: LocationAddress,
occupied: frozenset[LocationAddress] = frozenset(),
path_heuristic: Callable[
[
tuple[LaneAddress, ...],
tuple[LocationAddress, ...],
],
float,
] = lambda _, __: 0.0,
edge_weight: (
Callable[[LaneAddress], float] | None
) = None,
) -> (
tuple[
tuple[LaneAddress, ...], tuple[LocationAddress, ...]
]
| None
)
Find a weighted shortest path from start to end.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start
|
LocationAddress
|
The starting location. |
required |
end
|
LocationAddress
|
The ending location. |
required |
occupied
|
frozenset[LocationAddress]
|
Locations to exclude when searching for a path. If this excludes
|
frozenset()
|
path_heuristic
|
Callable[[tuple[LaneAddress, ...], tuple[LocationAddress, ...]], float]
|
A tie-breaker over candidate shortest paths, evaluated on the candidate location sequence. |
lambda _, __: 0.0
|
edge_weight
|
Callable[[LaneAddress], float] | None
|
Optional edge weight function used for shortest-path costs.
Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
tuple[tuple[LaneAddress, ...], tuple[LocationAddress, ...]] | None
|
A tuple containing:
- The selected path as |
tuple[tuple[LaneAddress, ...], tuple[LocationAddress, ...]] | None
|
Returns |
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/path.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | |
get_endpoints
get_endpoints(lane: LaneAddress)
Get the start and end LocationAddress for a given LaneAddress.
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/path.py
165 166 167 168 169 | |
get_lane
get_lane(
start: LocationAddress, end: LocationAddress
) -> LaneAddress | None
Get the LaneAddress connecting two LocationAddress sites.
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/path.py
152 153 154 155 156 157 158 159 160 161 162 163 | |
SiteTopology
Bases: Protocol
flowchart TD
bloqade.lanes.arch.SiteTopology[SiteTopology]
click bloqade.lanes.arch.SiteTopology href "" "bloqade.lanes.arch.SiteTopology"
Generates site buses for movement within a single word (row of sites).
TransversalSiteTopology
dataclass
TransversalSiteTopology(
logical_topology: SiteTopology,
code_distance: int,
intra_group_topology: SiteTopology | None = None,
)
Physical site topology derived from a logical site topology via code expansion.
Sites are organized in groups of code_distance. Group g contains
physical sites [g*d, g*d+1, ..., g*d+d-1] where d = code_distance.
Produces two kinds of buses (transversal buses first so that logical bus IDs are preserved):
-
Transversal buses -- each logical bus is "inflated" so that every
(src, dst)element becomesdparallel physical elements. Logical bus B becomes physical bus B with the same index. -
Intra-group buses (optional) -- generated by
intra_group_topologyfordsites, then replicated and offset for each group. These support non-transversal operations within a code word (e.g. Steane code initialisation, syndrome extraction).
WordGrid
dataclass
WordGrid(
words: tuple[Word, ...],
num_rows: int,
num_cols: int,
word_id_offset: int,
)
2D grid of words within a zone, preserving row/col structure.
all_word_ids
property
all_word_ids: range
All word IDs in this grid (contiguous range).
cz_pairs
cz_pairs() -> Iterator[tuple[int, int]]
Yield (word_id_a, word_id_b) for all CZ entangling pairs.
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/build/word_factory.py
47 48 49 50 51 | |
word_at
word_at(row: int, col: int) -> Word
Get the word at a given grid position.
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/build/word_factory.py
34 35 36 | |
word_id_at
word_id_at(row: int, col: int) -> int
Get the global word ID at a given grid position.
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/build/word_factory.py
38 39 40 | |
WordTopology
Bases: Protocol
flowchart TD
bloqade.lanes.arch.WordTopology[WordTopology]
click bloqade.lanes.arch.WordTopology href "" "bloqade.lanes.arch.WordTopology"
Generates word buses for movement between words in a 2D grid.
ZoneBuilder
ZoneBuilder(
name: str,
grid: Grid,
word_shape: tuple[int, int],
*,
x_clearance: float,
y_clearance: float
)
Build a single zone with its words, grid, and buses.
All indices are zone-local. Words are placed on the zone's grid and validated for shape and overlap. Buses are validated for AOD Cartesian product compliance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Human-readable zone name (stored in Rust Zone). |
required |
grid
|
Grid
|
Coordinate grid for this zone. Every x- and y-position must be representable at 1 nm precision (i.e., at most 3 decimal places when given in µm). |
required |
word_shape
|
tuple[int, int]
|
(num_x_sites, num_y_sites) — uniform shape for all words in this zone. sites_per_word = product of shape. |
required |
x_clearance
|
float
|
Minimum physical distance (> 0, µm) from grid lines that path waypoints must maintain on the x-axis. Must be representable at 1 nm precision. |
required |
y_clearance
|
float
|
Same as |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If either clearance is not positive or any position / clearance value is not nm-precise. |
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/build/imperative.py
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | |
blockade_radius
property
blockade_radius: float | None
Rydberg blockade radius (µm) used to derive entangling pairs, or None.
name
property
name: str
Zone name.
num_words
property
num_words: int
Number of words added so far.
sites
property
sites: _SiteGridQuery
Query site indices within the word shape.
sites_per_word
property
sites_per_word: int
Total sites per word (product of word_shape).
word_shape
property
word_shape: tuple[int, int]
(num_x_sites, num_y_sites) for each word.
words
property
words: _WordGridQuery
Query word indices by grid region for intra-zone use.
Returns a plain list[int] of zone-local word indices whose
sites intersect the queried region — suitable for passing
directly to add_word_bus / add_entangling_pairs.
For cross-zone references (e.g. ArchBuilder.connect), index
the zone itself (zone[region]) to get a name-qualified
(name, list[int]) tuple.
x_clearance
property
x_clearance: float
Minimum x-axis clearance (µm) from grid lines for waypoints.
y_clearance
property
y_clearance: float
Minimum y-axis clearance (µm) from grid lines for waypoints.
__getitem__
__getitem__(
key: tuple[
slice | int | Sequence[int],
slice | int | Sequence[int],
],
) -> tuple[str, list[int]]
Query word indices by grid region, name-qualified for cross-zone use.
Returns (self.name, zone.words[key]) so the result can be
passed directly to ArchBuilder.connect(src=..., dst=...),
which expects (zone_name, zone_local_indices).
For intra-zone use (passing indices to add_word_bus etc.),
use zone.words[key] which returns just the index list.
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/build/imperative.py
554 555 556 557 558 559 560 561 562 563 564 565 566 | |
add_entangling_pairs
add_entangling_pairs(
words_a: Sequence[int], words_b: Sequence[int]
) -> None
Mark paired zone-local words as CZ pairs.
words_a[i] is paired with words_b[i]. The two sequences
must have the same length.
For most users, prefer :meth:set_blockade_radius — it derives
the pair list directly from geometry and validates the word
layout against the CZ-pairing convention.
Any blockade_radius previously recorded on this zone (via
:meth:set_blockade_radius) is cleared, since a manual append
means the pair list is no longer purely radius-derived.
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/build/imperative.py
361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 | |
add_site_bus
add_site_bus(
src: Sequence[int], dst: Sequence[int]
) -> None
Add a site bus (intra-word movement).
src/dst are site indices within word_shape (0..sites_per_word). Must have equal length. Validates that src and dst positions each form a valid AOD Cartesian product on the word grid.
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/build/imperative.py
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 | |
add_word
add_word(
x_sites: slice | Sequence[int],
y_sites: slice | Sequence[int],
*,
has_site_bus: bool = True
) -> int
Add a word occupying the given grid positions.
The number of x-indices and y-indices must match word_shape. Grid positions must not overlap with any existing word.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_sites
|
slice | Sequence[int]
|
Grid x-indices for the word's sites. |
required |
y_sites
|
slice | Sequence[int]
|
Grid y-indices for the word's sites. |
required |
has_site_bus
|
bool
|
Whether this word participates in site-bus
transport. Feeds the zone-level
|
True
|
Returns:
| Type | Description |
|---|---|
int
|
Zone-local word index. |
Raises:
| Type | Description |
|---|---|
ValueError
|
Shape mismatch or grid position overlap. |
IndexError
|
Indices out of range for this zone's grid. |
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/build/imperative.py
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 | |
add_word_bus
add_word_bus(
src: Sequence[int], dst: Sequence[int]
) -> None
Add a word bus (intra-zone movement).
src/dst are zone-local word indices. Must have equal length. Validates that src and dst word positions each form a valid AOD Cartesian product on the zone grid.
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/build/imperative.py
336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 | |
set_blockade_radius
set_blockade_radius(radius: float) -> None
Derive entangling word pairs from the Rydberg blockade radius.
Scans every pair of distinct words in the zone and classifies each under the matching-site-index CZ convention:
- All matching-index site distances
<= radiusand all non-matching-index site distances> radius: valid CZ pair. - Some matching-index distances within radius, some outside:
ValueError(partial blockade — the word layout doesn't cleanly map onto the CZ-pairing convention). - Any non-matching-index site distance within radius (regardless
of whether the matching-index distances also fall within):
ValueError(crossed-index — two words are arranged such that siteiof one word sits next to sitej != iof the other, violating the exclusivity the convention requires). - All distances outside radius: words ignore each other, no pair recorded.
After classification, every word must appear in at most one
valid pair; multiple partners raise ValueError.
This call overwrites _entangling_pairs with the scan
result and stores the radius on the zone. To have it flow into
the final ArchSpec.blockade_radius, either call
:meth:ArchBuilder.set_blockade_radius (which applies to every
zone and records the value at builder scope) or, for a single
zone already set via ZoneBuilder.set_blockade_radius,
ArchBuilder.build() will pick up a consistent zone-level
radius automatically.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
radius
|
float
|
Blockade radius in micrometers. Must be positive and representable at 1 nm precision. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
if the layout is inconsistent with the radius
(partial blockade / crossed-index / multi-partner) or
if |
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/build/imperative.py
399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 | |
ZoneSpec
dataclass
ZoneSpec(
num_rows: int,
num_cols: int,
entangling: bool = False,
measurement: bool = True,
word_topology: WordTopology | None = None,
site_topology: SiteTopology | None = None,
)
Specification for a single zone in a multi-zone architecture.
Words are arranged in a 2D grid (num_rows x num_cols). Horizontally adjacent word pairs form CZ entangling pairs in entangling zones.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num_rows
|
int
|
Number of rows in the word grid. Must be >= 1. |
required |
num_cols
|
int
|
Number of columns in the word grid. Must be >= 2 and even. |
required |
entangling
|
bool
|
Whether this zone supports CZ entangling gates. |
False
|
measurement
|
bool
|
Whether this zone supports measurement. |
True
|
num_words
property
num_words: int
Total number of words in this zone.
build_arch
build_arch(
blueprint: ArchBlueprint,
connections: (
dict[tuple[str, str], InterZoneTopology] | None
) = None,
) -> ArchResult
Build an ArchSpec from a blueprint and inter-zone connections.
One blueprint zone maps to one Rust zone. Entangling pairs are metadata on the zone, not a reason to split into sub-zones.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
blueprint
|
ArchBlueprint
|
Architecture blueprint with zones and layout. |
required |
connections
|
dict[tuple[str, str], InterZoneTopology] | None
|
Inter-zone connectivity. Keys are (zone_a, zone_b) name pairs, values are InterZoneTopology instances. |
None
|
Returns:
| Type | Description |
|---|---|
ArchResult
|
ArchResult with the validated ArchSpec and metadata. |
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/build/blueprint.py
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 | |
create_zone_words
create_zone_words(
zone_spec: ZoneSpec,
layout: DeviceLayout,
x_offset: float = 0.0,
y_offset: float = 0.0,
word_id_offset: int = 0,
) -> WordGrid
Create all words for a zone in a 2D grid layout.
Each word's sites are represented as grid index pairs (x_idx, y_idx). For interleaved CZ pairs: - Even-column words: sites at x_idx = 0, 2, 4, ... (in the full grid) - Odd-column words: sites at x_idx = 1, 3, 5, ...
Words in different rows use different y_idx values.
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/build/word_factory.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | |