Problem simulating more than two states

Dear All,

I am trying to run a simulation using more than two states using the following code:

input_state = pcvl.BasicState([0,1,0,1,0,1,0,1])

c = pcvl.Circuit(8)
c.add(0, pcvl.BS.H())
c.add(2, pcvl.BS.H())
c.add(4, pcvl.BS.H())
c.add(6, pcvl.BS.H())


I get as a result for 100000 samples:

“results”: “:PCVL:BSSamples:|0,1,1,0,1,0,1,0>;|1,0,0,1,0,1,0,1>;|1,0,0,1,1,0,0,1>;|0,1,1,0,0,1,0,1>;|1,0,1,0,1,0,1,0>;|1,0,1,0,1,0,0,1>/0;1;2;3;4;5”

For 1000 samples I get simply:

“results”: “:PCVL:BSSamples:/”

Am I doing something wrong? I cannot understand the results.

I would appreciate any help.



I checked your job data on our cloud and it seems you didn’t set a min_detected_photon_filter on your remote_simulator and you used a number of shots equal to the number of expected samples of interest.

  1. This min_detected_photon_filter is the minimal coincidence size you’re willing to keep, the rest of states get filtered out.
    By default, the value for this filter is the number of photons in the input state (i.e. 4 in your example). Given your setup, these 4+ photon coincidences become what defines your samples of interest.
    See: Processor — perceval 0.10.3 documentation

  2. As you’re using sim:ascella which is a noisy simulator designed to reproduce the results of our Quantum Processing Unit qpu:ascella, you’re experiencing a lot of photon loss.
    sim:ascella default noise parameters can be found on the platform page on Quandela Cloud website: Quandela Cloud IDE

  3. Using a shots count equal to the sample count limits the acquisition (or the simulation, in this case) to a given number of coincidences, whether they are of interest (i.e. 4+ detected photons in your example) or not.
    More info: Run quantum algorithms — perceval 0.10.3 documentation

If you’re interested in all the output states of the noisy simulator, you can set:
If you only want 4+ photon coincidences, I suggest you increase (a lot) the shots you’re willing to “burn” for this simulation. Shots are kind of a usage credit user, so increasing the shots count means using more resources, but as the simulator is totally free, it will have no other effect than enhancing your results.

Best wishes,