I’m running the following circuit on the strawberry fields platform and the probabilities it generates arent adding to one and I can’t figure out why.
The circuit:
The array of probabilities it generates:
[1.126429679043999e-05, 0.0014664820957383993, 0.02522048151295811, 0.010012321153092966, 0.22563731287709546, 0.3744367053787543]
Hi @segev, I think that your cutoff_dim here may be too low. I tried it for a different matrix U and increasing your cutoff_dim to 3 or 4 can make a huge difference. If the problem remains then can you please post the output of sf.about()?
Hi @CatalinaAlbornoz thanks for your answer;
The issue is that I’m interested only on outcomes with up to 1 photon in each mode, that’s why I’ve chosen cutoff_dim = 2.
The relevant probabilites aren’t supposed to be summed to 1 for higher cutoff_dim. Isn’t the platform renormalized the fock states coefficients based on this cutoff and therefore supposed to produce appropriate probabilities?
Having low cutoff dimension means your state representation is incomplete and, as such, probabilities will not sum up to one. With that perspective, renormalizing the coefficients is not correct because the outcome is not a true probability distribution — the probabilities you see are those related to the possible outcomes you can get from your state representation.
However, I see from your circuit that your initial state is comprised of 2 photons, i.e., a cutoff of 3 should be enough to represent your state if your interferometer is passive (it includes no squeezing). I was not able to check that because copying and pasting your U leads to a non-unitary matrix due to numerical errors.
Try
import numpy as np
from strawberryfields.decompositions import bloch_messiah
S = np.block([[U.real, -U.imag], [U.imag, U.real]])
O1, Sq, O2 = bloch_messiah(S)
# evaluates to True if S is a passive transformation
print(np.allclose(Sq, np.identity(Sq.shape[0])))
and if it evaluates to True you know your transformation is passive. If not, you’ll have to increase your cutoff and the squeezing values on Sq could be used as a proxy to find an appropriate value.