sample_state_vector: Sample state vector

Description Usage Arguments Details Value Raises See Also

View source: R/sampling_simulations.R

Description

Samples repeatedly from measurements in the computational basis.

Usage

1

Arguments

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.

Details

Note that this does not modify the passed in state.

Value

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.

Raises

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.

See Also

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()


henry090/Cirq documentation built on June 13, 2020, 1:28 a.m.