What does this command physically mean?
block_diag([], BSunitaries, [])
Can any one tell me in matrix form?
Quantum Computing Stack Exchange is a question and answer site for engineers, scientists, programmers, and computing professionals interested in quantum computing. It only takes a minute to sign up.Sign up to join this community
A beamsplitter gates takes two parameters, and acts on two modes. The matrix that represents the gate is a 2x2 unitary. In this line you're calculating the unitary for the second 'column' in the circuit, which has a single beamsplitter. I've marked it in this image in blue:
In order to be able to multiply the unitaries for all of the columns together, they all need to be 4x4 so we first need to find the 2x2 unitary for the beamsplitter and then turn it into a 4x4 unitary.
BSunitaries contains the unitaries for each of the beamsplitters so you first extract the information for this specific unitary by using
block_diag creates a block diagonal matrix because you need
UBS2 to be a 4x4 unitary so
block_diag([], BSunitaries, []) is basically adding a '1' in the top left and a '1' in the bottom right. If you
print(block_diag([], [[2,3],[4,5]], [])) you'll get an idea of how this looks.
Catalina from Xanadu