A circuit to displace a wavefunction \psi(x) = \langle x | \psi \rangle using its quantum state |\psi\rangle which for illustration I will take to be the ground state |0\rangle (i.e. my wavefunction is just the ground state wavefunction of the Harmonic oscillator) could be constructed as follows. (I take the state to be qumode \texttt{q[1]})
prog = sf.Program(2)
with prog.context as q:
Fock(0) | q[0] #auxillary qumode set up
Fock(0) | q[1] #state of the system
CXgate(2) | (q[0],q[1])
MeasureHomodyne(phi=0,select=1) | q[0]
This displaces \psi(x) \to \psi(x-2). Suppose that I want to plot the PMF |\langle x |\psi\rangle|^2 = |\psi(x)|^2 of the system, after I’ve done this operation. One way to do this is to put the above circuit in a loop and then act with \texttt{MeasureX} on \texttt{q[1]}. From the histogram one can obtain the normalized pmf easily. However, one needs a large sample size and hence a large loop.
num_samples = 10000
samples = []
for _ in range(num_samples):
prog = sf.Program(2)
with prog.context as q:
Fock(0) | q[0] #auxillary qumode set up
Fock(0) | q[1] #state of the system
CXgate(2) | (q[0],q[1])
MeasureHomodyne(phi=0,select=1) | 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)
Is there a built in functionality for a two-qumode system that will extract the Fock modes of a qumode after a homodyne measurement has been done on its partner? I would want to obtain the Fock expansion of \texttt{q[1]} after I have performed the homodyne measurement on \texttt{q[0]} at y = 0 so that I can feed it into another circuit. Thanks. Sorry if this is trivial I am new to \texttt{StrawberryFields}.