# Cross Section in the Circuits

Hello,
For this circuit:

I first write this code (Thanks to @Tom_Bromley )

prog = sf.Program(modes)
with prog.context as q:
Ket(initial_state) | q # Initial state preparation

BSgate() | (q[0], q[1])
BSgate() | (q[2], q[3])

#BSgate() | (q[1], q[2])

Rgate((np.pi)/(8)) | q[0]
Rgate((np.pi)/(8)) | q[2]

BSgate() | (q[0], q[1])
BSgate() | (q[2], q[3])

Rgate(0) | q[0]
Rgate((np.pi)/2) | q[2]

BSgate() | (q[0], q[1])
BSgate() | (q[2], q[3])
#MeasureFock() | q[0]
#MeasureFock() | q[2]
MeasureFock() | q

results = eng.run(prog)

However I am quite confused with cross sections like the following figure:

And do you think that I should follow which mode goes to where
For instance in my circuit
0 mode goes to 2nd mode
1st mode goes to 0 mode
2nd mode goes to 3rd mode and finally
3rd mode goes to 1st mode
So should I change the indices after first beam splitter like that:
prog = sf.Program(modes)
with prog.context as q:
Ket(initial_state) | q # Initial state preparation

``````    BSgate() | (q[0], q[1])  #it is ok
BSgate() | (q[2], q[3])  #it is ok

#BSgate() | (q[1], q[2])

Rgate((np.pi)/(8)) | q[1]   # here they are going different places
Rgate((np.pi)/(8)) | q[0]   # same

BSgate() | (q[1], q[3])
BSgate() | (q[2], q[0])

Rgate(0) | q[3]
Rgate((np.pi)/2) | q[2]

BSgate() | (q[3], q[1])
BSgate() | (q[2], q[0])
#MeasureFock() | q[0]
#MeasureFock() | q[2]
MeasureFock() | q

results = eng.run(prog)``````

Hi @nisq,

However I am quite confused with cross sections like the following figure

To me this looks like a typical beamsplitter gate. Since it doesnâ€™t have a box in front, it would suggest that the beamsplitter is taking some default value - which I would guess to be a simple 50:50 beamsplitter. Where did you get the diagram? Perhaps you could confirm with the people who provided it to you.

And do you think that I should follow which mode goes to where

If I understand your question correctly - no, you do not need to try to permute the mode labels to follow the circuit. You should treat each horizontal line as a fixed mode label. Perhaps a photon will switch modes due to a beamsplitter, but this will just show up when comparing your input state to output state.

2 Likes

To me this looks like a typical beamsplitter gate. Since it doesnâ€™t have a box in front, it would suggest that the beamsplitter is taking some default value - which I would guess to be a simple 50:50 beamsplitter. Where did you get the diagram? Perhaps you could confirm with the people who provided it to you.

I totally agree and I even asked the people who are providing me the diagram and they just told that â€śNo waveguides are just crossing over eachselfâ€ť letâ€™s wait. Sometimes these things become clearer with time and maybe they will tell me a better explanations later. That is why I thought maybe I should change the index then. Because if I do not have beam splitter, how can they cross over theirself and I tried to change parameters but this time I needed to update all parameter and it is uselessâ€¦

If I understand your question correctly - no, you do not need to try to permute the mode labels to follow the circuit. You should treat each horizontal line as a fixed mode label. Perhaps a photon will switch modes due to a beamsplitter, but this will just show up when comparing your input state to output state.

Great! otherwise, I could not manage the situation. Now we have just 4 modes and suppose that we have many modes and no I canâ€™t be a detective

Hi @nisq,

I totally agree and I even asked the people who are providing me the diagram and they just told that â€śNo waveguides are just crossing over eachselfâ€ť letâ€™s wait. Sometimes these things become clearer with time and maybe they will tell me a better explanations later. That is why I thought maybe I should change the index then. Because if I do not have beam splitter, how can they cross over theirself and I tried to change parameters but this time I needed to update all parameter and it is uselessâ€¦

If you look at the BSGate in Strawberry Fields and the theory behind it, you can make the beamsplitterâ€™s action be to â€ścross overâ€ť the waveguides by setting the values of `theta` and `phi`. For example, a value of `theta = pi/2` and `phi = 0` should do the trick.

1 Like