cirq.stratified_circuit

Repacks avoiding simultaneous operations with different classes.

Used in the notebooks

Used in the tutorials

This transforms the given circuit to ensure that no operations of different categories are found in the same moment. Makes no optimality guarantees. Tagged Operations marked with any of context.tags_to_ignore will be treated as a separate category will be left in their original moments without stratification.

circuit The circuit whose operations should be re-arranged. Will not be modified.
context cirq.TransformerContext storing common configurable options for transformers.
categories A list of classifiers picking out certain operations. There are several ways to specify a classifier. You can pass in a gate instance (e.g. cirq.X), a gate type (e.g. cirq.XPowGate), an operation instance (e.g. cirq.X(cirq.LineQubit(0))), an operation type (e.g.cirq.CircuitOperation), or an arbitrary operation predicate (e.g. lambda op: len(op.qubits) == 2).

A copy of the original circuit, but with re-arranged operations.