cirq.SimulatesFinalState

Simulator that allows access to the simulator's final state.

Implementors of this interface should implement the simulate_sweep_iter method. This simulator only returns the state of the quantum system for the final step of a simulation. This simulator state may be a state vector, the density matrix, or another representation, depending on the implementation. For simulators that also allow stepping through a circuit see SimulatesIntermediateState.

Methods

simulate

View source

Simulates the supplied Circuit.

This method returns a result which allows access to the entire simulator's final state.

Args
program The circuit to simulate.
param_resolver Parameters to run with the program.
qubit_order Determines the canonical ordering of the qubits. This is often used in specifying the initial state, i.e. the ordering of the computational basis states.
initial_state The initial state for the simulation. The form of this state depends on the simulation implementation. See documentation of the implementing class for details.

Returns
SimulationTrialResults for the simulation. Includes the final state.

simulate_sweep

View source

Wraps computed states in a list.

Prefer overriding simulate_sweep_iter.

simulate_sweep_iter

View source

Simulates the supplied Circuit.

This method returns a result which allows access to the entire final simulator state. In contrast to simulate, this allows for sweeping over different parameter values.

Args
program The circuit to simulate.
params Parameters to run with the program.
qubit_order Determines the canonical ordering of the qubits. This is often used in specifying the initial state, i.e. the ordering of the computational basis states.
initial_state The initial state for the simulation. The form of this state depends on the simulation implementation. See documentation of the implementing class for details.

Returns
Iterator over SimulationTrialResults for this run, one for each possible parameter resolver.