Description Usage Arguments Details Value Raises See Also
View source: R/sampling_simulations.R
Samples repeatedly from measurements in the computational basis.
1 | sample_state_vector(state, indices)
|
state |
The multi-qubit wavefunction to be sampled. This is an array of 2 to the power of the number of qubit complex numbers, and so state must be of size “2**integer“. The state can be a vector of size “2**integer“ or a tensor of shape “(2, 2, ..., 2)“. |
indices |
Which qubits are measured. The state is assumed to be supplied in big endian order. That is the xth index of v, when expressed as a bitstring, has its largest values in the 0th index. |
Note that this does not modify the passed in state.
Measurement results with TRUE corresponding to the “|1⟩“ state. The outer list is for repetitions, and the inner corresponds to measurements ordered by the supplied qubits. These lists are wrapped as an numpy ndarray.
ValueError: “repetitions“ is less than one or size of “state“ is not a power of 2. IndexError: An index from “indices“ is out of range, given the number of qubits corresponding to the state.
Other Sampling, Simulations and Data collection:
big_endian_bits_to_int()
,
big_endian_digits_to_int()
,
big_endian_int_to_bits()
,
big_endian_int_to_digits()
,
circuit_like()
,
final_density_matrix()
,
final_wavefunction()
,
flatten_to_ops_or_moments()
,
flatten_to_ops()
,
flatten_with_params()
,
flatten_with_sweep()
,
flatten()
,
hog_score_xeb_fidelity_from_probabilities()
,
measure_density_matrix()
,
measure_state_vector()
,
random_state_or_seed_like()
,
sample_density_matrix()
,
sample_sweep()
,
sample()
,
to_resolvers()
,
to_sweep()
,
validate_mixture()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.