bloqade.gemini.compile.task.append_measurements_and_annotations
← Module overview
function
source
functionappend_measurements_and_annotations¶source
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) -> NoneAppend 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
| Name | Type | Description |
|---|---|---|
mt | ir.Method | A squin ``ir.Method`` whose body returns ``None``. |
m2dets | list[list[int]] | None | Binary matrix of shape ``(num_qubits * 7, num_detectors)``. Each column defines a detector by its non-zero row indices. |
m2obs | list[list[int]] | None | Binary matrix of shape ``(num_qubits * 7, num_observables)``. Each column defines an observable by its non-zero row indices. |
Raises
| Type | Description |
|---|---|
ValueError | If 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. |