deltakit.circuit.Circuit.reorder_detectors#

Circuit.reorder_detectors(key: Callable[[Detector], _Comparable] | None = None, reverse: bool = False)#

Reorder the detectors in this circuit according to the given key. Detectors are re-arranged within within certain “blocks” such that the logical behaviour is the same. The blocks are defined by gate layers which contain measurements and nested circuits.

Parameters:
  • key (Callable[[Detector], _Comparable] | None, optional) – The key to sort the detectors by, by default None which will use the lexical order of the coordinate. If passing a callable remember that some detectors might not have a coordinate so there should be a check in the callable for that.

  • reverse (bool) – Whether to reverse the sorting provided by key. This argument is passed directly to the sorted function, by default False.