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
747 stars 186 forks source link

Fix cat state function array type without doing casting #556

Closed nquesada closed 3 years ago

nquesada commented 3 years ago

Solves issue https://github.com/XanaduAI/strawberryfields/issues/554

codecov[bot] commented 3 years ago

Codecov Report

Merging #556 (2ff604d) into master (d8528d4) will not change coverage. The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #556   +/-   ##
=======================================
  Coverage   98.24%   98.24%           
=======================================
  Files          76       76           
  Lines        8429     8429           
=======================================
  Hits         8281     8281           
  Misses        148      148           
Impacted Files Coverage Δ
strawberryfields/ops.py 98.89% <100.00%> (ø)
strawberryfields/utils/states.py 100.00% <100.00%> (ø)

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 d8528d4...2ff604d. Read the comment docs.

nquesada commented 3 years ago

Hi @tguillaume : I have fixed the bug you found by multiplying a by 1.0 to automatically convert things to floats. I'd prefer this strategy to casting the "photon numbers" into floats.

tguillaume commented 3 years ago

Hey @nquesada, I think this does the trick nicely. Cheers!