cirq.merge_k_qubit_unitaries

Merges connected components of unitary operations, acting on <= k qubits.

Used in the notebooks

Used in the tutorials

Uses rewriter to convert a connected component of unitary operations acting on <= k-qubits into a more desirable form. If not specified, connected components are replaced by a single cirq.MatrixGate containing unitary matrix of the merged component.

circuit Input circuit to transform. It will not be modified.
context cirq.TransformerContext storing common configurable options for transformers.
k Connected components of unitary operations acting on <= k qubits are merged.
rewriter Callable type that takes a cirq.CircuitOperation, encapsulating a connected component of unitary operations acting on <= k qubits, and produces a cirq.OP_TREE. Specifies how to merge the connected component into a more desirable form.

Copy of the transformed input circuit.

ValueError If k <= 0