We're celebrating World Quantum Day 2022! Join us

Module: cirq.transformers.transformer_primitives

Defines primitives for common transformer patterns.


map_moments(...): Applies local transformation on moments, by calling map_func(moment) for each moment.

map_operations(...): Applies local transformations on operations, by calling map_func(op) for each op.

map_operations_and_unroll(...): Applies local transformations via cirq.map_operations & unrolls intermediate circuit ops.

merge_k_qubit_unitaries_to_circuit_op(...): Merges connected components of operations, acting on <= k qubits, into circuit operations.

merge_moments(...): Merges adjacent moments, one by one from left to right, by calling merge_func(m1, m2).

merge_operations(...): Merges operations in a circuit by calling merge_func iteratively on operations.

merge_operations_to_circuit_op(...): Merges connected components of operations and wraps each component into a circuit operation.

toggle_tags(...): Toggles tags applied on each operation in the circuit, via op.tags ^= tags

unroll_circuit_op(...): Unrolls (tagged) cirq.CircuitOperations while preserving the moment structure.

unroll_circuit_op_greedy_earliest(...): Unrolls (tagged) cirq.CircuitOperations by inserting operations using EARLIEST strategy.

unroll_circuit_op_greedy_frontier(...): Unrolls (tagged) cirq.CircuitOperations by inserting operations inline at qubit frontier.

CIRCUIT_TYPE Instance of typing.TypeVar
MAPPED_CIRCUIT_OP_TAG '<mapped_circuit_op>'