sf.apps.similarity.prob_event_mc

prob_event_mc(graph, photon_number, max_count_per_mode, n_mean=5, samples=1000, loss=0.0)[source]

Gives a Monte Carlo estimate of the GBS probability of a given event according to the input graph.

To make this estimate, several samples from the event are drawn uniformly at random using event_to_sample(). The GBS probabilities of these samples are then calculated and the sum is used to create an estimate of the event probability.

Example usage:

>>> graph = nx.complete_graph(8)
>>> prob_event_mc(graph, 4, 2)
0.1395
Parameters
  • graph (nx.Graph) – input graph encoded in the GBS device

  • photon_number (int) – number of photons in the event

  • max_count_per_mode (int) – maximum number of photons per mode in the event

  • 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

estimated orbit probability

Return type

float