Skip to content

Word

Word

Word(
    positions: Grid,
    site_indices: tuple[tuple[int, int], ...],
    has_cz: tuple[LocationAddress, ...] | None = None,
)

A group of atom sites that share a coordinate grid.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/layout/word.py
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
def __init__(
    self,
    positions: grid.Grid,
    site_indices: tuple[tuple[int, int], ...],
    has_cz: tuple[LocationAddress, ...] | None = None,
):
    self.positions = positions

    if len(self.positions.positions) != len(site_indices):
        raise ValueError("Number of positions must match number of site indices")
    if has_cz is not None and len(has_cz) != len(site_indices):
        raise ValueError("Length of has_cz must match number of site indices")

    rust_cz = (
        [(addr.word_id, addr.site_id) for addr in has_cz]
        if has_cz is not None
        else None
    )

    self._inner = _RustWord(
        positions=grid_to_rust(positions),
        site_indices=list(site_indices),
        has_cz=rust_cz,
    )

n_rows property

n_rows: int

Number of rows (sites per column) in this word.