cirq.Circuit.findall_operations_between

Circuit.findall_operations_between(start_frontier: Dict[cirq.ops.raw_types.Qid, int], end_frontier: Dict[cirq.ops.raw_types.Qid, int], omit_crossing_operations: bool = False) → List[Tuple[int, cirq.ops.raw_types.Operation]][source]

Finds operations between the two given frontiers.

If a qubit is in start_frontier but not end_frontier, its end index
defaults to the end of the circuit. If a qubit is in end_frontier but
not start_frontier, its start index defaults to the start of the
circuit. Operations on qubits not mentioned in either frontier are not
included in the results.
Parameters:
  • start_frontier – Just before where to start searching for operations, for each qubit of interest. Start frontier indices are inclusive.
  • end_frontier – Just before where to stop searching for operations, for each qubit of interest. End frontier indices are exclusive.
  • omit_crossing_operations – Determines whether or not operations that cross from a location between the two frontiers to a location outside the two frontiers are included or excluded. (Operations completely inside are always included, and operations completely outside are always excluded.)
Returns:

A list of tuples. Each tuple describes an operation found between the two frontiers. The first item of each tuple is the index of the moment containing the operation, and the second item is the operation itself. The list is sorted so that the moment index increases monotonically.