Skip to content

bloqade.gemini.compile.task.append_measurements_and_annotations

← Module overview

functionappend_measurements_and_annotationssource

bloqade.gemini.compile.task.append_measurements_and_annotations

Signature
def append_measurements_and_annotations(mt: ir.Method, m2dets: list[list[int]] | None, m2obs: list[list[int]] | None) -> None

Append terminal measurement, detector, and observable IR statements to a squin kernel.

The method is mutated in-place.

The annotations are Steane [[7,1,3]], so both matrices must be rectangular with one row per physical qubit: num_qubits * 7. A shape that disagrees is a ValueError rather than a silently mis-indexed annotation.

Parameters

NameTypeDescription
mtir.MethodA squin ``ir.Method`` whose body returns ``None``.
m2detslist[list[int]] | NoneBinary matrix of shape ``(num_qubits * 7, num_detectors)``. Each column defines a detector by its non-zero row indices.
m2obslist[list[int]] | NoneBinary matrix of shape ``(num_qubits * 7, num_observables)``. Each column defines an observable by its non-zero row indices.

Raises

TypeDescription
ValueErrorIf neither matrix is given; if ``mt`` allocates no qubits; if either matrix has the wrong number of rows or is ragged; or if ``mt``'s terminal measurement already declares a width other than Steane [[7,1,3]]'s seven.
source