tqecd.match_utils.cover.find_cover#

find_cover(target: BoundaryStabilizer, sources: list[BoundaryStabilizer], qubit_coordinates: dict[int, tuple[float, ...]], maximum_qubit_distance: int = 5) list[BoundaryStabilizer] | None[source]#

Try to cover the provided target stabilizer with stabilizers from sources.

This function is currently performing a bruteforce search: it tries all combinations of stabilizers from sources and check if one matches with the provided target. This approach blows up very quickly, as it may test up to 2**len(sources) different combinations before being able to tell that no match has been found.

Note that all the combinations are tested, even the only combination that consist in “picking nothing from the list”, resulting in an empty PauliString. To avoid any surprise, and because we do not expect an empty target to make sense here, this function will raise on such a case.

Parameters:
  • target – the boundary stabilizer to try to match with the provided sources.

  • sources – the boundary stabilizers that this function will try to combine to find a stabilizer involving target.

  • 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.

  • maximum_qubit_distance – radius (in number of qubits) to consider when searching for covering boundary stabilizers. Any boundary stabilizer in sources that has coordinates outside of that radius from target will not be considered, reducing the overall complexity of this function. The radius is computed with the Manhattan distance.

Raises:
  • TQECDException – if target is the empty PauliString.

  • TQECDException – if any of the provided instances in target or sources has anti-commuting stabilizers.

Returns:

a matching set of boundary stabilizers or None if no matching stabilizers could be found.