sf.apps.similarity.orbits

orbits(photon_number)[source]

Generate all the possible orbits for a given photon number.

Provides a generator over the integer partitions of photon_number. Code derived from website of Jerome Kelleher’s, which is based upon an algorithm from Ref. [21].

Example usage:

>>> o = orbits(5)
>>> list(o)
[[1, 1, 1, 1, 1], [2, 1, 1, 1], [3, 1, 1], [2, 2, 1], [4, 1], [3, 2], [5]]
Parameters

photon_number (int) – number of photons to generate orbits from

Returns

orbits with total photon number adding up to photon_number

Return type

Generator[list[int]]