We're celebrating World Quantum Day 2022! Join us

cirq.transformers.optimize_for_target_gateset

Transforms the given circuit into an equivalent circuit using gates accepted by gateset.

Used in the notebooks

Used in the tutorials
  1. Run all gateset.preprocess_transformers
  2. Convert operations using built-in cirq decompose + gateset.decompose_to_target_gateset.
  3. Run all gateset.postprocess_transformers

circuit Input circuit to transform. It will not be modified.
context cirq.TransformerContext storing common configurable options for transformers.
gateset Target gateset, which should be an instance of cirq.CompilationTargetGateset.
ignore_failures If set, operations that fail to convert are left unchanged. If not set, conversion failures raise a ValueError.

An equivalent circuit containing gates accepted by gateset.

ValueError If any input operation fails to convert and ignore_failures is False.