# Strawberryfields.fock: wire combiner/post selection

Hello,

Context:
I am trying to build an architecture that contains a feedback loop of a wire (with the strawberryfields.fock plugin). Every iteration, an input gets combined with a feedback state, after which it gets fed into a reservoir. Also every iteration, part of the reservoir output gets measured and part of the reservoir output gets feedbacked.

To combine the input state with the feedback state, I need some kind of combiner. For example (with 3 wires): if psi_in = [0,1,0] and psi_fb = 1/sqrt(2) [1,0,0] + 1/sqrt(2) [0,1,0], I want the result psi_combined = 1/sqrt(2) [1,1,0] + 1/sqrt(2) [0,2,0].

In practice, I would do this with a 2x1 multimode interferometer (MMI). Is there some way to achieve this in PennyLane?

In StrawberryFields I thought about coupling the correct wires and using post-selection, but I can’t seem to use post-selection in PennyLane. Is that correct?

Kind regards and thanks in advance,
Robbe

Hi @Robbe, welcome to the forum!

If I understand your question correctly, it should be possible to superpose two input states in PennyLane, e.g. for photonic systems:

qml.enable_tape()
constant = 1 / np.sqrt(2)

@qml.qnode(dev)
def f(input_state, feedback_state):
combined_state = (input_state + feedback_state) * constant
qml.FockStateVector(combined_state, wires=range(qubits))
...


However, unfortunately post-selection is not yet available in PennyLane, although it’s something we’d like to add soon. Instead, for your objective it may be a good idea to check out the TensorFlow 2.0 backend of Strawberry Fields (e.g., using this tutorial).

Hello @Tom_Bromley,

I don’t want to combine my states as (input_state + feedback_state) / np.sqrt(2). I want to add the photons of a certain mode of my input_state, to the corresponding mode of my feedback_state.

The problem is that I don’t know the feedback_state at a certain place in my network, because it isn’t measured yet. (It is a superposition as a result from an interferometer after which wavefunction collapse occurred in other wires). My input_state on the other hand is pure and known (one hot encoded in the fock state).

small example:
Feedback_state is a fock state on wire 0 and wire 1. It is a certain superpostion that is not measured yet. (e.g. a[0,0]+b[1,0]+c[0,1]+d[1,1]+...)
Input_state is a fock state [0,1] on wire 2 and wire 3.

I now want to add the single photon from wire 3 to wire 1.
Result: a[0,1]+b[1,1]+c[0,2]+d[1,2]+...

Does this make my question more clear?
Kind regards

Hi @Robbe — I am not sure I quite follow what you are trying to do. Can what you are trying to do be described by a linear operation acting on an input state?

At the moment I am thinking about 3 ways on how to do it practically. My question is if one of these options can be done in Pennylane or if there is a way to do something similar to this.

3 options:

1. In practice, I would want to do this with a 2x1 MMI (multimode interferometer). I don’t know if it is a linear operation. I don’t think it is reversible, so it isn’t unitary, but it could be linear.

I would need a MMI to combine mode i of my input_state with mode i of my feedback_state. So if my states are fock states with n photons in m modes, I would need m MMIs.

Important note: The MMI can also be 2x2, meaning that there are two outputs as well. Such an MMI could be designed to output both photons in one output arm, such that we can neglect the other output arm. This 2x2 MMI is the one I am looking for in Pennylane, because that is compatible with the wire-structure.

1. Another way of doing it, would be coherently pumping an extra photon in a certain wire. So in the next figure:
-What happens now: wires 2 and 3 get cleared. Then 0 photons are added to wire 2 and 1 photon is added to wire 3.
-What I want to do: not clearing the wires beforehand and just adding the photons. (I want to add the photons of my input_state to the existing wires of my feedback state.)
2. Another approach (which can’t be done here, because it requires post-selection):
Placing a certain gate on 2 wires that couples them (e.g. wire 0 = a wire of the input state; wire 1 = a wire of the feedback state) and afterwards measure wire 0 and do a post-selection of 0 photons. By doing that, I know that the photon of my input state was added to wire 1. The gate could for example be a beamsplitter, but I don’t know whether the Hong-ou-Mandel effect would sometimes prevent the probability of all photons combining in 1 wire.

What physically happens with the fock states (assume photons in 2 modes):

Feedback_state = a[0,0]+b[1,0]+c[0,1]+d[1,1]+...

Input_state = [0,1]

Before combining them, the states are defined on separate Hilbert spaces:

Feedback_state ⊗ input_state  = (a[0,0]+b[1,0]+c[0,1]+d[1,1]+...)⊗[0,1]  = a[0,0]⊗[0,1]+b[1,0]⊗[0,1]+c[0,1]⊗[0,1]+d[1,1]⊗[0,1]+...

Now using the 2 different MMIs would transform [n_1,n_2]⊗[n_3,n_4] to [n_1+n_3,n_2+n_4]. (The first MMI works on the 1st mode of both states. The second MMI works on the second mode of each state).

Result: a[0,1]+b[1,1]+c[0,2]+d[1,2]+...