You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
val = PrepareUniformSuperposition(n=6, cvs=(1,)), default = None, flatten = True
context = DecompositionContext(qubit_manager=<cirq.ops.qubit_manager.SimpleQubitManager object at 0x1723452a0>), args = (), kwargs = {}
method = <bound method GateWithRegisters.decompose_with_context of PrepareUniformSuperposition(n=6, cvs=(1,))>
def decompose_once(
val: Any,
default=RaiseTypeErrorIfNotProvided,
*args,
flatten: bool = True,
context: Optional[DecompositionContext] = None,
**kwargs,
):
"""Decomposes a value into operations, if possible.
This method decomposes the value exactly once, instead of decomposing it
and then continuing to decomposing the decomposed operations recursively
until some criteria is met (which is what `cirq.decompose` does).
Args:
val: The value to call `_decompose_` on, if possible.
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`.
*args: Positional arguments to forward into the `_decompose_` method of
`val`. For example, this is used to tell gates what qubits they are
being applied to.
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.
**kwargs: Keyword arguments to forward into the `_decompose_` method of
`val`.
Returns:
The result of `val._decompose_(*args, **kwargs)`, 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.
Raises:
TypeError: `val` didn't have a `_decompose_` method (or that method returned
`NotImplemented` or `None`) and `default` wasn't set.
"""
if context is None:
context = DecompositionContext(
ops.SimpleQubitManager(prefix=f'_decompose_protocol_{next(_CONTEXT_COUNTER)}')
)
method = getattr(val, '_decompose_with_context_', None)
decomposed = NotImplemented if method is None else method(*args, **kwargs, context=context)
E TypeError: GateWithRegisters.decompose_with_context() missing 1 required positional argument: 'qubits'
</details>
The text was updated successfully, but these errors were encountered:
example traceback:
val = PrepareUniformSuperposition(n=6, cvs=(1,)), default = None, flatten = True
context = DecompositionContext(qubit_manager=<cirq.ops.qubit_manager.SimpleQubitManager object at 0x1723452a0>), args = (), kwargs = {}
method = <bound method GateWithRegisters.decompose_with_context of PrepareUniformSuperposition(n=6, cvs=(1,))>
E TypeError: GateWithRegisters.decompose_with_context() missing 1 required positional argument: 'qubits'
The text was updated successfully, but these errors were encountered: