Hello!
I am trying to design the following circuits:
In this circuit: first two modes corresponds to first qubit 0_a and 1_a and the other 2 modes corresponds to 0_b and 1_b. Blue boxes are my phase shofters. orange boxes are 50:50 beam siplitter
I started to code but I am stuck:
import strawberryfields as sf
from strawberryfields.ops import Ket, BSgate, Interferometer
import numpy as np
cutoff_dim = 5 # (1+ total number of photons)
paths = 2
modes = 2 * paths #I created my modes and totally I have 4 modes
initial_state = np.zeros([cutoff_dim] * modes, dtype=np.complex)
# The ket below corresponds to a single horizontal photon in each of the modes
initial_state[0, 1, 0, 1] = 1
# Permutation matrix
X = np.array([[0, 1], [1, 0]])
prog = sf.Program(modes)
with prog.context as q:
Ket(initial_state) | q # Initial state preparation
for i in range(paths):
BSgate() | (q[2 * i], q[2 * i + 1]) # First layer of beamsplitters
eng = sf.Engine("fock", backend_options={"cutoff_dim": cutoff_dim})
result = eng.run(prog)
state = result.state
However after that I stuck: I should produce the state (|0_a 1b>+|1_a 0_b>)/sqrt(2) in correspondence of the green line, upon post-selection of one photon per qubit modesfor given an input state |0_a 0_b>
This is the first code with StrawberryField so I will be glas if someone can explain me briefly
I took cutoff like 5 but I am not so sure that it is ok?
And I also do not know how to write code for after first beam splitters there is a place which s coming cross and there is no beamsplitter there and after that I need to do a produce the state (|0_a 1b>+|1_a 0_b>)/sqrt(2) in correspondence of the green line, upon post-selection of one photon per qubit modesfor given an input state |0_a 0_b>…