I want to reproduce the time evolution in this paper in which they are performing a homodyne measurement ‘at y = 0’ (before eq. 3.16). I did not understand how one can perform a homodyne measurement at a value of the position. Can someone explain (including implementation)? Thanks.
Hi @tenebr1s , welcome to the Forum!
It looks to me like they’re doing post-selection.
You can learn about post-selection here. In the example there you will see
MeasureHomodyne(0, select=1) | q[0]
.
If you look at the docs for MeasureHomodyne and compare it with the line of code above, you’ll notice that in this example the measurement angle is 0
(meaning that you’re measuring in the X basis), the desired value of measurement result is 1
, and this measurement is being done on the first qumode (q[0]
). This looks a lot like what’s in the paper you shared. I don’t know for sure if this is the case but you can email the authors and ask them too!
I hope this helps.
Hi @CatalinaAlbornoz Glad to be here! Thanks for replying. So after post-selecting y = 0, how does one get |\psi(x)|^2? The way that I am attempting to do is use \texttt{MeasureX} on the other qumode. This returns a value of x. Repeating this for a number of times and then plotting a histogram of the obtained values in theory does give me the modulus of the wavefunction squared, but I am not sure if this is the best/only way to do it. Sorry, I’m new to SF and unfamiliar with the syntax.
Here is an example snippet of what I am trying to do:
num_samples = 1000
samples = []
for _ in range(num_samples):
prog = sf.Program(2)
with prog.context as q:
Ket(aux_ket) | q[0] #auxillary qumode set up
Fock(0) | q[1] #state of the system
#gates implementing the circuit go here
MeasureHomodyne(phi=0,select=0) | q[0]
MeasureX | q[1]
eng = sf.Engine("fock", backend_options={"cutoff_dim":some_cutoff})
result = eng.run(prog)
state = result.samples[0][1]
samples.append(state)
Making a histogram (see for eg. this post) out of this should give me the PMF which is |\langle x|\psi\rangle|^2 in theory. This gets better as I increase \texttt{num_samples} in the above code. But is this the only way to do it?
Hi @tenebr1s ,
I’m not sure. I’ll forward your question to some colleagues who might be able to help.
Hi @tenebr1s ,
I got an answer from my colleagues.
If instead of measuring the second mode, you leave it unmeasured, then the program will return a state. Then that state has a method for getting the quadrature distribution (see x_quad_values in the docs).
I hope this helps!