cirq.Moment¶

class cirq.Moment(**kwargs)[source]

A time-slice of operations within a circuit.

Grouping operations into moments is intended to be a strong suggestion to
whatever is scheduling operations on real hardware. Operations in the same
moment should execute at the same time (to the extent possible; not all
operations have the same duration) and it is expected that all operations
in a moment should be completed before beginning the next moment.
Moment can be indexed by qubit or list of qubits:
moment[qubit] returns the Operation in the moment which touches the
given qubit, or throws KeyError if there is no such operation.
moment[qubits] returns another Moment which consists only of those
operations which touch at least one of the given qubits. If there
are no such operations, returns an empty Moment.
__init__(*contents: cirq.OP_TREE) → None[source]

Constructs a moment with the given operations.

Parameters

operations – The operations applied within the moment. Will be flattened and frozen into a tuple before storing.

Raises

ValueError – A qubit appears more than once.

Methods

 operates_on(qubits) Determines if the moment has operations touching the given qubits. Determines if the moment has operations touching the given qubit. Returns the same moment, but with different qubits. with_operation(operation) Returns an equal moment, but with the given op added. Returns an equal moment, but without ops on the given qubits.

Attributes