cirq.protocols.act_on

Applies an action to a state argument.

For example, the action may be a cirq.Operation and the state argument may represent the internal state of a state vector simulator (a cirq.ActOnStateVectorArgs).

The action is applied by first checking if action._act_on_ exists and returns True (instead of NotImplemented) for the given object. Then fallback strategies specified by the state argument via _act_on_fallback_ are attempted. If those also fail, the method fails with a TypeError.

action The action to apply to the state tensor. Typically a cirq.Operation.
args A mutable state object that should be modified by the action. May specify an _act_on_fallback_ method to use in case the action doesn't recognize it.
allow_decompose Defaults to True. Forwarded into the _act_on_fallback_ method of args. Determines if decomposition should be used or avoided when attempting to act action on args. Used by internal methods to avoid redundant decompositions.

Nothing. Results are communicated by editing args.

TypeError Failed to act action on args.