Any way to get consistent average photon values for Gaussian Boson Sampling for same rotations?

Tried implementing GBS as per this circuit diagram (https://medium.com/xanaduai/introducing-the-strawberry-fields-applications-layer-b61f55c82689) and using the circuits in the X8 tutorial.

I have tried increasing the number of shots, but I still get very different average photon values for outputs for a set of rotations when running different times. Any way to help make the averages more in accordance with one another?

Thanks!

Hi @Samarth_Sandeep ā€” Could you share the code you are using to generate the samples?

    ops.S2gate(1.0) | (q[0], q[4])
    ops.S2gate(1.0) | (q[1], q[5])
    ops.S2gate(1.0) | (q[2], q[6])
    ops.S2gate(1.0) | (q[3], q[7])

    ops.Interferometer(unitary_mat) | (q[0], q[1], q[2], q[3])
    ops.Rgate(math.pi/2) | q[0]
    ops.Rgate(math.pi/2) | q[1]
    ops.Rgate(math.pi/2) | q[2]
    ops.Rgate(math.pi/2) | q[3]
    ops.BSgate(math.pi/4, math.pi/2) | (q[1], q[0])
    ops.BSgate(math.pi/4, math.pi/2) | (q[2], q[3])
    ops.Rgate(math.pi/2) | q[1]
    ops.Rgate(math.pi/2) | q[2]
    ops.Rgate(rmath.pi/2) | q[0]
    ops.BSgate(math.pi/4, math.pi/2) | (q[1], q[2])
    ops.Rgate(math.pi/2) | q[3]
    ops.Rgate(math.pi/2) | q[1]
    ops.Rgate(math.pi/2) | q[2]
    ops.BSgate(math.pi/4, math.pi/2) | (q[1], q[0])
    ops.BSgate(math.pi/4, math.pi/2) | (q[2], q[3])
    ops.Rgate(math.pi/2) | q[1]
    ops.Rgate(math.pi/2) | q[2]
    ops.BSgate(math.pi/4, math.pi/2) | (q[1], q[2])


    ops.Interferometer(unitary_mat) | (q[4], q[5], q[6], q[7])
    ops.Rgate(math.pi/2) | q[4]
    ops.Rgate(math.pi/2) | q[5]
    ops.Rgate(math.pi/2) | q[6]
    ops.Rgate(math.pi/2) | q[7]
    ops.BSgate(math.pi/4, math.pi/2) | (q[4], q[5])
    ops.BSgate(math.pi/4, math.pi/2) | (q[6], q[7])
    ops.Rgate(math.pi/2) | q[5]
    ops.Rgate(math.pi/2) | q[6]
    ops.Rgate(math.pi/2) | q[4]
    ops.BSgate(math.pi/4, math.pi/2) | (q[5], q[6])
    ops.Rgate(math.pi/2) | q[7]
    ops.Rgate(math.pi/2) | q[5]
    ops.Rgate(math.pi/2) | q[6]
    ops.BSgate(math.pi/4, math.pi/2) | (q[4], q[5])
    ops.BSgate(math.pi/4, math.pi/2) | (q[6], q[7])
    ops.Rgate(math.pi/2) | q[5]
    ops.Rgate(math.pi/2) | q[6]
    ops.BSgate(math.pi/4, math.pi/2) | (q[5], q[6])

    ops.MeasureFock() | q

Hi @Samarth_Sandeep ---- How many samples are you using to calculate averages? Also, are you doing a simulation or are you using the hardware?

Iā€™m using the hardware and was doing 1000 shots.

Can you also post the results that you got and that seem inconsistent?

These both are using the same interferometer angles and same rotation angles, but the photon averages are very different:

Trial 1:
[[1 0 2 ā€¦ 0 2 3]
[0 1 0 ā€¦ 0 1 1]
[1 0 2 ā€¦ 1 1 0]
ā€¦
[0 3 0 ā€¦ 1 2 1]
[2 0 4 ā€¦ 1 3 1]
[0 0 0 ā€¦ 0 0 4]]
[0.98 1. 0.925 0.82 0.905 0.84 1.085 0.895]

Trial 2:
[[0 3 0 ā€¦ 1 2 0]
[2 1 3 ā€¦ 1 3 3]
[0 0 2 ā€¦ 1 1 0]
ā€¦
[0 0 0 ā€¦ 0 0 0]
[0 0 3 ā€¦ 2 1 0]
[4 0 0 ā€¦ 0 0 2]]
[1.03 0.87 0.93 0.975 1. 0.89 0.91 1.005]

Hi @Samarth_Sandeep ā€” From a quick statistical analysis the means you report have a relative difference

\text{rel_dif} = \frac{|\text{mean1} - \text{mean2}|}{\tfrac12 (\text{mean1} + \text{mean2})}

of at most 17% . This is a bit too high but is not wholly inconsistent with a simple estimate that will predict a relative difference of on the order of 1/\sqrt{M} \sim 3\% for M=1000 thousand samples.

Can I suggest you use more samples to estimate these averages. If you increase the number of samples by one-hundred fold, you should expect to decrease the relative difference by one order of magnitude.

Hope this helps,

Nicolas

Thanks for the answer @Nicolas_Quesada! Will give it a shot (no pun intended). That makes sense.

1 Like