measure_with_samples(mp, state, shots, is_state_batched=False, rng=None, prng_key=None)[source]

Returns the samples of the measurement process performed on the given state. This function assumes that the user-defined wire labels in the measurement process have already been mapped to integer wires used in the device.

  • mp (SampleMeasurement) – The sample measurement to perform

  • state (np.ndarray[complex]) – The state vector to sample from

  • shots (Shots) – The number of samples to take

  • is_state_batched (bool) – whether the state is batched or not

  • rng (Union[None, int, array_like[int], SeedSequence, BitGenerator, Generator]) – A seed-like parameter matching that of seed for numpy.random.default_rng. If no value is provided, a default RNG will be used.

  • prng_key (Optional[jax.random.PRNGKey]) – An optional jax.random.PRNGKey. This is the key to the JAX pseudo random number generator. Only for simulation using JAX.


Sample measurement results

Return type