XanaduAI / strawberryfields

Strawberry Fields is a full-stack Python library for designing, simulating, and optimizing continuous variable (CV) quantum optical circuits.
https://strawberryfields.ai
Apache License 2.0
754 stars 191 forks source link

reduced_dm not correct for subsystems of more than 1 mode #469

Closed co9olguy closed 4 years ago

co9olguy commented 4 years ago

Issue description

Source code and tracebacks

Minimal (non)working example:

import strawberryfields as sf

modes = 3
fock_cutoff = 3
prog = sf.Program(modes)
eng = sf.Engine("tf", backend_options={"cutoff_dim": fock_cutoff})
result = eng.run(prog)
state = result.state
d01 = state.reduced_dm([0,1])
d02 = state.reduced_dm([0,2])
print(d01.shape)
print(d02.shape)
>>> ()  # should be (3,3,3,3)
>>> ()  # should be (3,3,3,3)
nquesada commented 4 years ago

Was this closed here https://github.com/XanaduAI/strawberryfields/pull/471 @thisac ?

thisac commented 4 years ago

@nquesada Yes, this should've been closed by #471. Thanks for spotting it!