View source on GitHub |
Applies an action to a state argument.
cirq.act_on(
action: Any,
sim_state: 'cirq.SimulationStateBase',
qubits: Optional[Sequence['cirq.Qid']] = None,
*,
allow_decompose: bool = True
)
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.StateVectorSimulationState
).
For non-operations, the qubits
argument must be explicitly supplied.
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
.
Returns | |
---|---|
Nothing. Results are communicated by editing sim_state .
|