Skip to content

Lattice

ConcreteState dataclass

ConcreteState(
    occupied: frozenset[LocationAddress],
    layout: tuple[LocationAddress, ...],
    move_count: tuple[int, ...],
)

Bases: AtomState


              flowchart TD
              bloqade.lanes.analysis.placement.lattice.ConcreteState[ConcreteState]
              bloqade.lanes.analysis.placement.lattice.AtomState[AtomState]

                              bloqade.lanes.analysis.placement.lattice.AtomState --> bloqade.lanes.analysis.placement.lattice.ConcreteState
                


              click bloqade.lanes.analysis.placement.lattice.ConcreteState href "" "bloqade.lanes.analysis.placement.lattice.ConcreteState"
              click bloqade.lanes.analysis.placement.lattice.AtomState href "" "bloqade.lanes.analysis.placement.lattice.AtomState"
            

layout instance-attribute

layout: tuple[LocationAddress, ...]

Stores the current location of the ith qubit argument in layout[i].

move_count instance-attribute

move_count: tuple[int, ...]

Stores the number of moves each atom has undergone.

occupied instance-attribute

occupied: frozenset[LocationAddress]

Stores the set of occupied locations with atoms not participating in this static circuit.

ExecuteCZ dataclass

ExecuteCZ(
    occupied: frozenset[LocationAddress],
    layout: tuple[LocationAddress, ...],
    move_count: tuple[int, ...],
    active_cz_zones: frozenset[ZoneAddress],
    move_layers: tuple[tuple[LaneAddress, ...], ...] = (),
)

Bases: ConcreteState


              flowchart TD
              bloqade.lanes.analysis.placement.lattice.ExecuteCZ[ExecuteCZ]
              bloqade.lanes.analysis.placement.lattice.ConcreteState[ConcreteState]
              bloqade.lanes.analysis.placement.lattice.AtomState[AtomState]

                              bloqade.lanes.analysis.placement.lattice.ConcreteState --> bloqade.lanes.analysis.placement.lattice.ExecuteCZ
                                bloqade.lanes.analysis.placement.lattice.AtomState --> bloqade.lanes.analysis.placement.lattice.ConcreteState
                



              click bloqade.lanes.analysis.placement.lattice.ExecuteCZ href "" "bloqade.lanes.analysis.placement.lattice.ExecuteCZ"
              click bloqade.lanes.analysis.placement.lattice.ConcreteState href "" "bloqade.lanes.analysis.placement.lattice.ConcreteState"
              click bloqade.lanes.analysis.placement.lattice.AtomState href "" "bloqade.lanes.analysis.placement.lattice.AtomState"
            

Defines the state representing the placement of atoms before/after executing CZ gate pulse.

NOTE: you can specify multiple entnangling zones to be active in a single ExecuteCZ state in cases where there are multiple entangling zones that can be used in parallel.

active_cz_zones instance-attribute

active_cz_zones: frozenset[ZoneAddress]

The set of CZ zones that need to execute for this round of CZ gates.

move_layers class-attribute instance-attribute

move_layers: tuple[tuple[LaneAddress, ...], ...] = ()

The layers of moves that need to be executed to reach this state.

verify

verify(
    arch_spec: ArchSpec,
    controls: tuple[int, ...],
    targets: tuple[int, ...],
)

Returns True if the current atom configuration will execute the provided entangled pairs.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/analysis/placement/lattice.py
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
def verify(
    self, arch_spec: ArchSpec, controls: tuple[int, ...], targets: tuple[int, ...]
):
    """Returns True if the current atom configuration will execute the provided entangled pairs."""
    if len(targets) != len(controls):
        return False

    for control, target in zip(controls, targets):
        if control < 0 or control >= len(self.layout):
            return False
        if target < 0 or target >= len(self.layout):
            return False

        c_addr = self.layout[control]
        t_addr = self.layout[target]

        if (arch_spec.get_cz_partner(c_addr) != t_addr) and (
            arch_spec.get_cz_partner(t_addr) != c_addr
        ):
            return False

    return True

ExecuteCZReturn dataclass

ExecuteCZReturn(
    occupied: frozenset[LocationAddress],
    layout: tuple[LocationAddress, ...],
    move_count: tuple[int, ...],
    active_cz_zones: frozenset[ZoneAddress],
    move_layers: tuple[tuple[LaneAddress, ...], ...] = (),
    *,
    initial_layout: tuple[LocationAddress, ...]
)

Bases: ExecuteCZ


              flowchart TD
              bloqade.lanes.analysis.placement.lattice.ExecuteCZReturn[ExecuteCZReturn]
              bloqade.lanes.analysis.placement.lattice.ExecuteCZ[ExecuteCZ]
              bloqade.lanes.analysis.placement.lattice.ConcreteState[ConcreteState]
              bloqade.lanes.analysis.placement.lattice.AtomState[AtomState]

                              bloqade.lanes.analysis.placement.lattice.ExecuteCZ --> bloqade.lanes.analysis.placement.lattice.ExecuteCZReturn
                                bloqade.lanes.analysis.placement.lattice.ConcreteState --> bloqade.lanes.analysis.placement.lattice.ExecuteCZ
                                bloqade.lanes.analysis.placement.lattice.AtomState --> bloqade.lanes.analysis.placement.lattice.ConcreteState
                




              click bloqade.lanes.analysis.placement.lattice.ExecuteCZReturn href "" "bloqade.lanes.analysis.placement.lattice.ExecuteCZReturn"
              click bloqade.lanes.analysis.placement.lattice.ExecuteCZ href "" "bloqade.lanes.analysis.placement.lattice.ExecuteCZ"
              click bloqade.lanes.analysis.placement.lattice.ConcreteState href "" "bloqade.lanes.analysis.placement.lattice.ConcreteState"
              click bloqade.lanes.analysis.placement.lattice.AtomState href "" "bloqade.lanes.analysis.placement.lattice.AtomState"
            

ExecuteCZ with palindrome return moves encoded at analysis time.

Produced by PalindromePlacementStrategy so that InsertMoves can emit both forward moves (before the CZ gate) and return moves (after the CZ gate) in a single pass, without a separate InsertReturnMoves pass.

initial_layout records the atom layout before the forward moves were applied. PalindromePlacementStrategy uses this when the next CZ gate arrives and its input state is an ExecuteCZReturn — it extracts the home ConcreteState so the next placement starts from the correct position.

return_move_layers is the strict palindrome of move_layers: layer order reversed, and within each layer the lane order is also reversed with each lane's direction flipped. Reversing the within-layer order is required for correctness when a forward layer contains dependent lanes — i.e. atom A vacates position X and atom B immediately enters X in the same layer. On the return, B must be processed first (so B vacates X before A tries to re-enter it); preserving the forward order would cause A to collide with B. The value is computed eagerly from move_layers in __post_init__.

initial_layout class-attribute instance-attribute

initial_layout: tuple[LocationAddress, ...] = field(
    kw_only=True
)

Atom layout before forward moves were applied (the home position).

return_move_layers class-attribute instance-attribute

return_move_layers: tuple[tuple[LaneAddress, ...], ...] = (
    field(init=False)
)

Palindrome of move_layers; computed at construction.

ExecuteMeasure dataclass

ExecuteMeasure(
    occupied: frozenset[LocationAddress],
    layout: tuple[LocationAddress, ...],
    move_count: tuple[int, ...],
    zone_maps: tuple[ZoneAddress, ...],
    move_layers: tuple[tuple[LaneAddress, ...], ...] = (),
)

Bases: ConcreteState


              flowchart TD
              bloqade.lanes.analysis.placement.lattice.ExecuteMeasure[ExecuteMeasure]
              bloqade.lanes.analysis.placement.lattice.ConcreteState[ConcreteState]
              bloqade.lanes.analysis.placement.lattice.AtomState[AtomState]

                              bloqade.lanes.analysis.placement.lattice.ConcreteState --> bloqade.lanes.analysis.placement.lattice.ExecuteMeasure
                                bloqade.lanes.analysis.placement.lattice.AtomState --> bloqade.lanes.analysis.placement.lattice.ConcreteState
                



              click bloqade.lanes.analysis.placement.lattice.ExecuteMeasure href "" "bloqade.lanes.analysis.placement.lattice.ExecuteMeasure"
              click bloqade.lanes.analysis.placement.lattice.ConcreteState href "" "bloqade.lanes.analysis.placement.lattice.ConcreteState"
              click bloqade.lanes.analysis.placement.lattice.AtomState href "" "bloqade.lanes.analysis.placement.lattice.AtomState"
            

A state representing measurement placements.

NOTE: Depending on the placement of the atoms you may need to specify which atoms are measured by which zone. This is done via the zone_maps field, such that zone_maps[i] gives the zone that measures the ith qubit.

move_layers class-attribute instance-attribute

move_layers: tuple[tuple[LaneAddress, ...], ...] = ()

The layers of moves that need to be executed to reach this state.

zone_maps instance-attribute

zone_maps: tuple[ZoneAddress, ...]

The mapping from qubit index to the zone that measures it.