Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Base Gaussian State dm doesn't preserve locality dimensions #726

Open
1 task done
aplund opened this issue Jul 21, 2022 · 1 comment
Open
1 task done

Base Gaussian State dm doesn't preserve locality dimensions #726

aplund opened this issue Jul 21, 2022 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@aplund
Copy link

aplund commented Jul 21, 2022

Before posting a bug report

  • I have searched exisisting GitHub issues to make sure the issue does not already exist.

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

>>> sf.about()

Strawberry Fields: a Python library for continuous-variable quantum circuits.
Copyright 2018-2020 Xanadu Quantum Technologies Inc.

Python version:            3.10.5
Platform info:             Linux-5.18.12-arch1-1-x86_64-with-glibc2.35
Installation path:         /home/lund/.local/lib/python3.10/site-packages/strawberryfields
Strawberry Fields version: 0.23.0
Numpy version:             1.22.4
Scipy version:             1.8.1
SymPy version:             1.10.1
NetworkX version:          2.8.5
The Walrus version:        0.19.0
Blackbird version:         0.4.0
XCC version:               0.2.1
TensorFlow version:        None

Source code

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}")

Tracebacks

No response

Additional information

No response

@aplund aplund added the bug Something isn't working label Jul 21, 2022
@CatalinaAlbornoz
Copy link

Hi @aplund, thank you for reporting this bug. We will take a look into it.

@sduquemesa sduquemesa changed the title [replace with a short descriptive title for your report] Base Gaussian State dm doesn't preserve locality dimensions Jul 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants