cirq.SupportsDecompose

class cirq.SupportsDecompose(*args, **kwargs)[source]

An object that can be decomposed into simpler operations.

Returning NotImplemented means “not decomposable”. Otherwise an operation,
list of operations, or generally anything meeting the OP_TREE contract can
be returned.
For example, a Toffoli could be decomposed into Hadamards, CNOTs, and Ts.
These operations are simpler because they act on fewer qubits. In general, a
decomposition should move closer towards the basic 1-qubit and 2-qubit gates
included by default in cirq. It is not necessary to get all the way there,
just closer (callers will iteratively decompose if needed).
DECOMPOSITIONS MUST NEVER BE CYCLIC. If B has A in its decomposition, A
should not have B in its decomposition. Decomposition is often performed
iteratively, until a fixed point or some desired criteria is met. Cyclic
decompositions cause that kind of code to loop forever.
__init__(*args, **kwargs)

Methods