cirq.MergeSingleQubitGates¶
-
class
cirq.MergeSingleQubitGates(*, rewriter: Optional[Callable[List[cirq.ops.raw_types.Operation], Union[cirq.ops.raw_types.Operation, Iterable[Any], None]]] = None, synthesizer: Optional[Callable[[cirq.ops.raw_types.QubitId, numpy.ndarray], Union[cirq.ops.raw_types.Operation, Iterable[Any], None]]] = None)[source]¶ Optimizes runs of adjacent unitary 1-qubit operations.
-
__init__(*, rewriter: Optional[Callable[List[cirq.ops.raw_types.Operation], Union[cirq.ops.raw_types.Operation, Iterable[Any], None]]] = None, synthesizer: Optional[Callable[[cirq.ops.raw_types.QubitId, numpy.ndarray], Union[cirq.ops.raw_types.Operation, Iterable[Any], None]]] = None)[source]¶ Parameters: - rewriter – Specifies how to merge runs of single-qubit operations into a more desirable form. Takes a list of operations and produces a list of operations. The default rewriter computes the matrix of the run and returns a cirq.SingleQubitMatrixGate. If rewriter returns None, that means “do not rewrite the operations”.
- synthesizer – A special kind of rewriter that operates purely on the unitary matrix of the intended operation. Takes a qubit and a unitary matrix and returns a list of operations. Can’t be specified at the same time as rewriter. If synthesizer returns None, that means “do not rewrite the operations used to make this matrix”.
Methods
optimization_at(circuit, index, op)Describes how to change operations near the given location. optimize_circuit(circuit)Rewrites the given circuit to make it better. -