Closed ScottGlancy closed 1 year ago
Hi @ScottGlancy , thank you for reporting this bug. We will look into it.
Hi @ScottGlancy!
The bosonic backend does not restrict the input coefficients to be real and hence does not do a "hard" check to see if the weights add up to one. The reason for this is that some states require imaginary weights to produce interference fringes and negativity in the Wigner function.
On the other hand, a "linear combination of Gaussians" refers to
You can find all details about the bosonic backend in the paper Fast simulation of bosonic qubits via Gaussian functions in phase space as well as some hands-on examples (e.g., check 1, 2, 3) on the strawberryfields documentation.
@sduquemesa, I understand that creating states using linear combinations of Gaussians that are not probabilistic mixtures can be useful, but I don't know of any situations in which one would want to use ops.Bosonic to create something that is not a quantum state. Checking that the input parameters create a quantum state seems like it would be helpful.
However, I just noticed that the concluding section of the "Fast Simulation..." paper says "it would be of interest to determine the exact mathematical conditions for physicality in terms of the parameters of the states (weights, vectors of means and covariances matrices).". Apparently building the input error checking that I am asking for will require actual research.
In the meantime, I would recommend better documentation of ops.Bosonic to explain the precise input format it needs and to warn users that it might create non-physical states. ops.Bosonic is never used in the examples demonstrating the bosonic engine, so I had to use some trial-and-error to find the input format.
Before posting a bug report
Expected behavior
The documentation here says that Bosonic(weights=None, means=None, covs=None) will prepare a mode as a linear combination of Gaussian functions in phase space. The input weights are coefficients for each Gaussian in the linear combination. "Linear combination" is ambiguous, but based on some testing, I believe it means "probabilistic mixture" rather than "superposition". If that is true, I expect that Bosonic should test that weights are probabilities and give an error if they are not.
Actual behavior
The resulting state is has a Wigner function that is the sum of the weighted Gaussian functions, regardless of the weights. The result will not be a quantum state if the weights are not probabilities.
sf.ops.Bosonic([-1], [[0,0]], [[[1,0],[0,1]]]) prepares a state whose Wigner function is equal to the vacuum Wigner function except that is it negative everywhere.
Reproduces how often
always
System information
Source code
Tracebacks
No response
Additional information
No response