sample#
- diffqc.sample(key: PRNGKeyArray, probs: Array, shape: Tuple[int]) Array #
Sample proportional to probabilities
- Parameters
key (jax.random.PRNGKeyArray) – Random Key.
probs (1d jnp.ndarray) – Probabilities of n-qubit state
shape (tuple of ints) – Sample shape
- Returns
Sampled index. e.g.
0 -> |000>, 1 -> |001>
for 3-qubits.- Return type
jnp.ndarray