Merges connected components of unitary operations, acting on <= k qubits.
cirq.merge_k_qubit_unitaries(
circuit: 'cirq.AbstractCircuit',
*,
context: Optional['cirq.TransformerContext'] = None,
k: int = 0,
rewriter: Optional[Callable[['cirq.CircuitOperation'], 'cirq.OP_TREE']] = None
) -> 'cirq.Circuit'
Used in the notebooks
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.
Args |
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.
|
Returns |
Copy of the transformed input circuit.
|
Raises |
ValueError
|
If k <= 0
|