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

Gkps state prep #517

Closed GDauphinais closed 3 years ago

GDauphinais commented 3 years ago

Fixed some hbar factors in real cat state preparation.

codecov[bot] commented 3 years ago

Codecov Report

:exclamation: No coverage uploaded for pull request base (gkps@24ab0ee). Click here to learn what that means. The diff coverage is n/a.

@@           Coverage Diff           @@
##             gkps     #517   +/-   ##
=======================================
  Coverage        ?   88.77%           
=======================================
  Files           ?       75           
  Lines           ?     8260           
  Branches        ?        0           
=======================================
  Hits            ?     7333           
  Misses          ?      927           
  Partials        ?        0           

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 24ab0ee...6638bf2. Read the comment docs.

elib20 commented 3 years ago

Looks good to me! I was able to produce the same Wigner function using both representations as well as the Fock representation.

GDauphinais commented 3 years ago

Little detail that may come in handy for specific applications: for approximate states the numerical error / tolerance isn't unified. Could be a nice feature to add to have some uniformity there.

Also, running frontend test, I get the message: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray I have python 3.8.5 I believe the culprit may be this line : means = np.array([[a for b in tup for a in b] for tup in mean_combs], dtype=complex) (in backend.py)

elib20 commented 3 years ago

I am also using Python 3.8.5 and I don't get that error. I am using numpy version 1.18.5. Which version are you using? Guillaume: I was using numpy 1.19.2