tqecd.match.match_boundary_stabilizers#

match_boundary_stabilizers(left_flows: FragmentFlows | FragmentLoopFlows, right_flows: FragmentFlows | FragmentLoopFlows, qubit_coordinates: Mapping[int, tuple[float, ...]], perform_sanity_check: bool = True) list[MatchedDetector][source]#

Match detectors using the boundary stabilizers between the two given flows.

This function try to match detectors that will be valid at the end of right_flows by looking at destruction boundary stabilizers back-propagated from measurements in right_flows and creation boundary stabilizers propagated from resets in left_flows. The above 2 stabilizer types should meet at the interface between the two provided flows. If we find any creation stabilizer matching (i.e. being equal to) any other destruction stabilizer, these form a detector!

This function mutates `left_flows` and `right_flows` in-place if a detector is found.

Parameters:
  • left_flows – pre-computed flows from the left fragment.

  • right_flows – pre-computed flows from the right fragment.

  • qubit_coordinates – _description_

  • perform_sanity_check – If True and if right_flows is an instance of FragmentLoopFlows, detectors found between left_flows and right_flows are compared to the detectors found between the last and first fragments of the body of right_flows. If the two sets are not equal, an exception is raised. Defaults to True.

Raises:

TQECDException – if the sanity check does not pass.

Returns:

all matched detectors.