sf.apps.similarity.event_cardinality¶
-
event_cardinality
(photon_number, max_count_per_mode, modes)[source]¶ Gives the number of samples belonging to the input event.
For example, for three modes, there are six samples in an \(E_{k=2, n_{\max}=2}\) event: [1, 1, 0], [1, 0, 1], [0, 1, 1], [2, 0, 0], [0, 2, 0], and [0, 0, 2].
Example usage:
>>> event_cardinality(2, 2, 3) 6
- Parameters
photon_number (int) – number of photons in the event
max_count_per_mode (int) – maximum number of photons per mode in the event
modes (int) – number of modes in counted samples
- Returns
number of samples in the event
- Return type
int
code/api/strawberryfields.apps.similarity.event_cardinality
Download Python script
Download Notebook
View on GitHub