import strawberryfields as sf
import strawberryfields.ops as op
p = sf.Program(2)
with p.context as q:
op.Squeezed(1) | q[0]
e = sf.Engine('fock', backend_options={'cutoff_dim': 4})
r = e.run(p)
print(f"Fock engine density matrix shape {r.state.dm().shape}")
e = sf.Engine('gaussian')
r = e.run(p)
print(f"Gaussian engine density matrix shape {r.state.dm(cutoff=4).shape}")
Before posting a bug report
Expected behavior
BaseGaussianState.dm() doesn't preserve locality dimensions. The Fock basis backend and Gaussian backend should give the same results.
Actual behavior
state.dm() gives gives only 2 dimensional matricies. The Fock basis state gives a multi-index object depending on the number of modes.
Reproduces how often
Always
System information
Source code
Tracebacks
No response
Additional information
No response