![]() |
Simulator that computes final amplitudes of given bitstrings.
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 method.
Methods
compute_amplitudes
compute_amplitudes(
program: "cirq.Circuit",
bitstrings: Sequence[int],
param_resolver: "study.ParamResolverOrSimilarType" = None,
qubit_order: cirq.ops.QubitOrderOrList
= cirq.ops.QubitOrder.DEFAULT
) -> Sequence[complex]
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
@abc.abstractmethod
compute_amplitudes_sweep( program: "cirq.Circuit", bitstrings: Sequence[int], params:
cirq.study.Sweepable
, qubit_order:cirq.ops.QubitOrderOrList
= cirq.ops.QubitOrder.DEFAULT ) -> Sequence[Sequence[complex]]
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 | |
---|---|
List of lists of amplitudes. The outer dimension indexes the circuit parameters and the inner dimension indexes the bitstrings. |