Is it possible to obtain matrix representation of operators in the Fock backend?
Does Fock backend truncation preserve the commutation relationships between the quadrature operators? If so, the exact decompositions given in Exact and approximate continuous-variable gate decompositions should hold in truncated Fock basis, right?
Hi @Omar_Ibna_Nazim, welcome back to the forum!
I don’t think we have something to get the matrix representation of operators. Strawberry Fields does have several methods that can be applied to states as you can see here, including a dm method to get the numerical density matrix for a quantum state in the Fock basis. However this isn’t really what you’re asking for.
I’d say the commutation relationships will hold up to a certain extent but if your cutoff dimension is too low and you loose too much information then the decompositions shown in the paper may not hold.
My recommendation would be to perform a small experiment and change the cutoff to see if the decomposition changes.
You may also benefit from using MrMustard. This can help you generate graphs which can help you gauge whether the cutoff seems right or too low.
I hope this helps!
1 Like
Hi @Omar_Ibna_Nazim ,
I got some good pointers for you from my colleagues Eli and Rachel.
Fock representations of common operators can be found in thewalrus: Fock representations — The Walrus 0.22.0-dev documentation
Strawberryfields uses this library to get those operators when using the Fock backend.
Also available in MrMustard, for example
from mrmustard import lab
from thewalrus import fock_gradients as fg
cutoff=2
# MrMustard
squeezing = lab.Sgate(r=[0.4])
print(squeezing.U(cutoffs=[cutoff]))
# TheWalrus
print(fg.squeezing(r=0.4,theta=0,cutoff=2))
# MrMustard
beamsplitter = lab.BSgate(theta=0.5)
print(beamsplitter.U(cutoffs=[cutoff,cutoff]))
# TheWalrus
print(fg.beamsplitter(0.5,0,2))
# MrMustard
interferometer = lab.Interferometer(2)
print(interferometer.U(cutoffs=[cutoff,cutoff]))
On the other hand (this may or may not be relevant for you), if you have some operator in the Fock basis that can be decomposed into two operators A and B (they have imaginary hats) then the n,m Fock element is <n|AB|m>. You can put the identity in the middle like sum_k <n|A|k><k|B|m> but the sum has to go to infinity for it to work exactly. By truncating and putting both operators in the Fock basis they will lose some accuracy.
1 Like