cirq.circuits.InsertStrategy

Indicates preferences on how to add multiple operations to a circuit.

EARLIEST Instance of cirq.circuits.InsertStrategy

Scans backward from the insert location until a moment with operations touching qubits affected by the operation to insert is found. The operation is added into the moment just after that location.

If the scan reaches the start of the circuit without finding any conflicting operations, the operation is added into the first moment of the circuit.

The operation is never added into moments after the insert location. If the moment just before the insert location has conflicting operations, or the insert index is 0, then the operation is inserted into a new moment at the desired location.

INLINE Instance of cirq.circuits.InsertStrategy

Attempts to add the operation to insert into the moment just before the desired insert location. But, if there's already an existing operation affecting any of the qubits touched by the operation to insert, or the desired index is 0, a new moment is created and inserted at the desired location instead. In case the insert index is smaller than -len() it is treated like it would be 0. For too big indices it attempts to insert the operation into the last moment of the circuit.

NEW Instance of cirq.circuits.InsertStrategy

Always creates a new moment at the desired insert location, and adds the operation to insert into that moment.

NEW_THEN_INLINE Instance of cirq.circuits.InsertStrategy

Creates a new moment at the desired insert location for the first operation, but then switches to inserting operations inline.