-
Notifications
You must be signed in to change notification settings - Fork 192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pure states are not pure #488
Comments
Hi @ziofil, I think what is happening here is that you have two local state preparations. IIRC the way things rae coded is that local state preparations force the simulator to use a mixed state representation. When you are preparing a state locally, you have two options for how you might implement: either do something like Obviously the first solution only works if you have a factorized state (and furthermore know the local pure state), so it was decided to do the second solution in general. There is the option we could consider to---in this case at least---check whether you are still in the vacuum. If so, then the update would be much easier to implement |
Oh I see, thank you. |
👍, this is something that trips me up somewhat often (I always forget that |
If anyone stumbles here, this is a possible workaround if your initial state is simple enough to be written in this way: import strawberryfields as sf
modes = 2
cutoff = 3
circuit = sf.Program(modes)
eng = sf.Engine("fock", backend_options={'cutoff_dim': cutoff})
ket = np.zeros([cutoff]*modes, dtype=np.complex128)
ket[1,1] = 1.0 + 0.0j
with circuit.context as q:
sf.ops.Ket(ket) | q
output = eng.run(circuit)
output.state.is_pure
# True |
I tried to boil it down as much as possible. For some reason, states that should be pure are identified as mixed (in both the
tf
andfock
backends):I haven't investigated the issue yet
The text was updated successfully, but these errors were encountered: