Helpers

Module name: qmlt.helpers

Code author: Maria Schuld <maria@xanadu.ai>

Collection of helpers to set up an experiment with either the numerical or tf circuit learner.

Summary

sample_from_distribution(distribution) Sample a Fock state from a nested probability distribution of Fock states.

Code details

qmlt.helpers.sample_from_distribution(distribution)[source]

Sample a Fock state from a nested probability distribution of Fock states.

Parameters:distribution (ndarray) – Nested array containing probabilities of Fock state. Fock state \(|i,j,k \rangle\) is retrieved by distribution([i,j,k]). Can be the result of state.all_fock_probs().

Return: List of photon numbers representing a Fock state.