qsimcirq.QSimhSimulator

Simulator that computes final amplitudes of given bitstrings.

Used in the notebooks

Used in the tutorials

Given a circuit and a list of bitstrings, computes the amplitudes of the given bitstrings in the state obtained by applying the circuit to the all zeros state. Implementors of this interface should implement the compute_amplitudes_sweep_iter method.

qsim_options A map of circuit options for the simulator. These will be applied to all circuits run using this simulator. Accepted keys and their behavior are as follows:

- 'k': Comma-separated list of ints. Indices of "part 1" qubits.
- 'p': int (>= 0). Number of "prefix" gates.
- 'r': int (>= 0). Number of "root" gates.
- 't': int (> 0). Number of threads to run on. Default: 1.
- 'v': int (>= 0). Log verbosity. Default: 0.
- 'w': int (>= 0). Prefix value.

See qsim/docs/usage.md for more details on these options.

Methods

compute_amplitudes

Computes the desired amplitudes.

The initial state is assumed to be the all zeros state.

Args
program The circuit to simulate.
bitstrings The bitstrings whose amplitudes are desired, input as an integer array where each integer is formed from measured qubit values according to qubit_order from most to least significant qubit, i.e. in big-endian ordering.
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.

Returns
List of amplitudes.

compute_amplitudes_sweep

View source

Wraps computed amplitudes in a list.

Prefer overriding compute_amplitudes_sweep_iter.

compute_amplitudes_sweep_iter

Computes the desired amplitudes.

The initial state is assumed to be the all zeros state.

Args
program The circuit to simulate.
bitstrings The bitstrings whose amplitudes are desired, input as an integer array where each integer is formed from measured qubit values according to qubit_order from most to least significant qubit, i.e. in big-endian ordering.
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.

Returns
An Iterator over lists of amplitudes. The outer dimension indexes the circuit parameters and the inner dimension indexes bitstrings.