Hi there,
I ran into a problem, potentially not a problem, when running the Boson sampling example code from the website (Boson Sampling — perceval v0.13 documentation).
I’m pretty much running a 1:1 copy of the code, just changed the number of photons to 4, the modes to 20, and the number of samples to 50k, so I don’t need to wait that long.
Everything runs pretty much fine, however, when I look at the results:
with gzip.open(filepath + ".txt.gz", "rt") as f:
for l in f:
l = l.strip()
if l.startswith("|") and l.endswith(">"):
try:
st = pcvl.BasicState(l)
count+=1
bunching_distribution[st.photon2mode(st.n-1)]+=1
except Exception:
pass
print(count, "samples")
print("Bunching Distribution:", "\t".join([str(bunching_distribution[k]) for k in range(M)]))
it only gives me 20 outputs rather than the m!/(n!(m-n)!) = 4845 possible modes to distribute 4 photons in 20 modes. I believe something is not quite right, so different results are put into the same category, but I am not sure. It looks like the line creating the bunching_distribution checks every state for the number of photons <st.n>, but then the <st.photon2mode(st.n-1)> does what exactly? I assume the -1 is just for indexing in Python, but I’m lost as to what is happening there. Like I did a little toy example, it returned 2 for the state [1,0,1,1], [0,0,1,1], and [0,1,1,0], so it would sort all in the same category.
The help only says:
photon2mode(…)
photon2mode(self: exqalibur.FockState, arg0: int) → int
and I’m a physicist, not a CS guy
Any help would be appreciated and my apologies if it is not quite clear what I am trying to say here.
I have some sort of idea what might be happening but would prefer for someone smarter to explain it
Thanks
Markus