Unusual behaviour of squeezing

prog = sf.Program(1)
amp = 0.8
np.random.seed(0)
x = np.random.rand(2)

with prog.context as q:
    sf.ops.Squeezed(r=amp,p=0) | q[0]
        
eng = sf.LocalEngine('fock', backend_options={'cutoff_dim': 24})
result = eng.run(prog)    

prog2 = sf.Program(1)
with prog2.context as n:
    sf.ops.Squeezed(r=amp,p=10) | n[0]

eng = sf.LocalEngine('fock', backend_options={'cutoff_dim': 24})
result1 = eng.run(prog)    

The output of the following:
np.vdot(result1.state.data,result.state.data)

(0.9999886803073812+0j)

while it should be approximately:
“0.6340021261700056” according to image

the version of Strawberryfields is ‘0.11.2’

the following code solves the issue i’m sorry for any inconvenience

prog = sf.Program(1)
amp = 1.2

with prog.context as q:
    sf.ops.Squeezed(r=amp,p=5) | q[0]
        
eng = sf.Engine('fock', backend_options={'cutoff_dim': 40})
result = eng.run(prog)    

prog2 = sf.Program(1)
with prog2.context as n:
    sf.ops.Squeezed(r=amp,p=5) | n[0]

eng1 = sf.Engine('fock', backend_options={'cutoff_dim': 40})
result1 = eng1.run(prog2)    

this will result in the following:

vec = result1.state.reduced_dm(modes=0)
vec2 = result.state.reduced_dm(modes=0)

and the dot product will be:

np.vdot(vec,vec2) >> 0.9997011993187223

we can also use a single node with multiple qumodes and access each one using the reduced density matrix. please be careful about the trace of the system if you are going to use r>1 please increase the cut off number

Hi @kareem_essafty,

Yes, the energy of the system (and correspondingly, the size of cutoff you need to accurately simulate it) increases exponentially with the squeezing parameter r. It’s always good to check the trace of the state when working with even a modest amount of squeezing.

1 Like