sf.apps.similarity.prob_orbit_mc¶
-
prob_orbit_mc
(graph, orbit, n_mean=5, samples=1000, loss=0.0)[source]¶ Gives a Monte Carlo estimate of the probability of a given orbit for the input graph.
To make this estimate, several samples from the orbit are drawn uniformly at random using
orbit_to_sample()
. The GBS probabilities of these samples are then calculated and the sum is used to create an estimate of the orbit probability.Example usage:
>>> graph = nx.complete_graph(8) >>> prob_orbit_mc(graph, [2, 1, 1]) 0.03744399092424391
- Parameters
graph (nx.Graph) – input graph encoded in the GBS device
orbit (list[int]) – orbit for which to estimate the probability
n_mean (float) – total mean photon number of the GBS device
samples (int) – number of samples used in the Monte Carlo estimation
loss (float) – fraction of photons lost in GBS
- Returns
Monte Carlo estimated orbit probability
- Return type
float
code/api/strawberryfields.apps.similarity.prob_orbit_mc
Download Python script
Download Notebook
View on GitHub