cirq.InsertStrategy | Cirq | Google Quantum AI (original) (raw)
Indicates preferences on how to add multiple operations to a circuit.
cirq.InsertStrategy(
name: str, doc: str
)
Class Variables | |
---|---|
EARLIEST | Instance of cirq.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.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.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.InsertStrategy Creates a new moment at the desired insert location for the first operation, but then switches to inserting operations inline. |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-04-15 UTC.