cirq.Circuit.batch_insert¶
-
Circuit.batch_insert(insertions: Iterable[Tuple[int, Union[cirq.ops.raw_types.Operation, Iterable[Any]]]]) → None[source]¶ Applies a batched insert operation to the circuit.
Transparently handles the fact that earlier insertions may shiftthe index that later insertions should occur at. For example, if youinsert an operation at index 2 and at index 4, but the insert at index 2causes a new moment to be created, then the insert at “4” will actuallyoccur at index 5 to account for the shift from the new moment.All insertions are done with the strategy ‘EARLIEST’.
When multiple inserts occur at the same index, the gates from the laterinserts end up before the gates from the earlier inserts (exactly as ifyou’d called list.insert several times with the same index: the laterinserts shift the earliest inserts forward).Parameters: insertions – A sequence of (insert_index, operations) pairs indicating operations to add into the circuit at specific places.