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

faster gaussian compiling #598

Closed jakeffbulmer closed 3 years ago

jakeffbulmer commented 3 years ago

to speed up large circuits with a lot of gates, we wish to avoid a full size, dense matrix-matrix multiplication upon application of each gate.

In this PR we will try to avoid this. My first attempt is to use scipy.sparse.csr_matrix to reduce the complexity of the matrix-matrix multiplications. However, we may also look into hardcoding the matrix-matrix multiplication.

Before submitting

Please complete the following checklist when submitting a PR:

When all the above are checked, delete everything above the dashed line and fill in the pull request template.


Context:

Description of the Change:

Benefits:

Possible Drawbacks:

Related GitHub Issues:

codecov[bot] commented 3 years ago

Codecov Report

Merging #598 (d9dceab) into master (7984174) will increase coverage by 0.00%. The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #598   +/-   ##
=======================================
  Coverage   98.45%   98.46%           
=======================================
  Files          76       76           
  Lines        8758     8780   +22     
=======================================
+ Hits         8623     8645   +22     
  Misses        135      135           
Impacted Files Coverage Δ
strawberryfields/compilers/gaussian_unitary.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 7984174...d9dceab. Read the comment docs.

jakeffbulmer commented 3 years ago

because of scipy sparse overheads, I think this change would only actually help for systems with several hundred modes or more!