Decomposes a value into operations on the given qubits.
cirq.decompose_once_with_qubits(
val: Any,
qubits: Iterable['cirq.Qid'],
default=RaiseTypeErrorIfNotProvided,
flatten: bool = True,
context: Optional['DecompositionContext'] = None
)
This method is used when decomposing gates, which don't know which qubits
they are being applied to unless told. It decomposes the gate exactly once,
instead of decomposing it and then continuing to decomposing the decomposed
operations recursively until some criteria is met.
Args |
val
|
The value to call ._decompose_(qubits) on, if possible.
|
qubits
|
The value to pass into the named qubits parameter of
val._decompose_ .
|
default
|
A default result to use if the value doesn't have a
_decompose_ method or that method returns NotImplemented or
None . If not specified, non-decomposable values cause a
TypeError .
|
flatten
|
If True, the returned OP-TREE will be flattened to a list of operations.
|
context
|
Decomposition context specifying common configurable options for
controlling the behavior of decompose.
|
Returns |
The result of val._decompose_(qubits) , if val has a
_decompose_ method and it didn't return NotImplemented or None .
Otherwise default is returned, if it was specified. Otherwise an error
is raised.
|
TypeError |
val didn't have a _decompose_ method (or that method returned
NotImplemented or None ) and default wasn't set.
|