Description Usage Arguments Details Value Raises See Also
View source: R/sampling_simulations.R
Samples repeatedly from measurements in the computational basis.
1 | sample_density_matrix(density_matrix, indices)
|
density_matrix |
The density matrix to be measured. This matrix is assumed to be positive semidefinite and trace one. The matrix is assumed to be of shape '(2 ** integer, 2 ** integer)' or (2, 2, ..., 2). |
indices |
Which qubits are measured. The density matrix rows and columns are 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 density_matrix.
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 “matrix“ is not a power of 2. IndexError: An index from “indices“ is out of range, given the number of qubits corresponding to the density matrix.
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_state_vector()
,
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.