tqecd.match.match_detectors_from_flows_shallow#
- match_detectors_from_flows_shallow(flows: list[FragmentFlows | FragmentLoopFlows], qubit_coordinates: dict[int, tuple[float, ...]]) list[list[MatchedDetector]] [source]#
Match detectors in the provided fragments.
This function only performs a shallow search. Read attentively the warning and return sections of this documentation to understand how to use it correctly.
Warning
This function only performs a shallow computation! It will consider REPEAT constructs as an atomic fragment with outgoing stabilizers on both sides, but will not recurse in the loop.
In practice, this limitation should not be a huge issue. As the loops are still considered as an atomic operation, resets in the last fragment of the loop body and measurements in the first fragment of the loop body are still accounted for. This means that if the loop body only implements a simple QEC round (e.g., surface code or repetition code), or more generally if the loop body is considered as a single
Fragment
instance, the detectors will be appropriately matched and returned.- Parameters:
flows – a list of fragment flow to search detectors in.
qubit_coordinates – a mapping from qubit indices to coordinates. Used to annotate the matched detectors with the coordinates from the qubits involved in the measurement forming the detector.
- Returns:
the list of all the detectors found. These detectors are only valid if inserted at the end of the fragment represented by the last provided flow in the input parameter flows. If the last provided flow is an instance of
FragmentLoopFlows
then the returned detectors should be inserted at the end of the loop body.