class cirq.google.ConvertToXmonGates(extensions: cirq.extension.extensions.Extensions = None, ignore_failures=False)[source]

Attempts to convert strange gates into XmonGates.

First, checks if the given extensions are able to cast the gate into an
XmonGate instance.
Second, checks if the given extensions are able to cast the operation into a
KnownMatrix. If so, and the gate is a 1-qubit or 2-qubit gate, then performs circuit synthesis of the operation.
Third, checks if the given extensions are able to cast the operation into a
CompositeOperation. If so, recurses on the decomposition.
Fourth, if ignore_failures is set, gives up and returns the gate unchanged.
Otherwise raises a TypeError.
__init__(extensions: cirq.extension.extensions.Extensions = None, ignore_failures=False) → None[source]
Parameters: extensions – The extensions instance to use when trying to cast gates to known types. Defaults to the standard xmon gate extension. ignore_failures – If set, gates that fail to convert are forwarded unchanged. If not set, conversion failures raise a TypeError.

Methods

 convert(op) 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.