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

Adds Torontonian sampling support to the Gaussian backend #152

Merged
merged 15 commits into from Aug 20, 2019
Merged

Conversation

nquesada
Copy link
Collaborator

Description of the Change:
Adds threshold (torontonian) sampling to the capabilities of the Gaussian backend.
Benefits:
Threshold samples can be generated directly instead of doing PNR and then threshold by hand. Should give significant saving in time and it is useful for apps upstream.
Possible Drawbacks:

Related GitHub Issues:

@nquesada nquesada requested a review from trbromley July 30, 2019 18:08
@codecov
Copy link

codecov bot commented Jul 30, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@0d1685c). Click here to learn what that means.
The diff coverage is 78.57%.

@@            Coverage Diff            @@
##             master     #152   +/-   ##
=========================================
  Coverage          ?   97.59%           
=========================================
  Files             ?       36           
  Lines             ?     5325           
  Branches          ?        0           
=========================================
  Hits              ?     5197           
  Misses            ?      128           
  Partials          ?        0
Impacted Files Coverage Δ
strawberryfields/circuitspecs/gaussian.py 100% <ø> (ø)
strawberryfields/backends/tfbackend/__init__.py 80% <ø> (ø)
strawberryfields/circuitspecs/gbs.py 100% <ø> (ø)
strawberryfields/decompositions.py 99.56% <100%> (ø)
strawberryfields/backends/gaussianbackend/ops.py 97.29% <100%> (ø)
strawberryfields/backends/base.py 87.96% <100%> (ø)
strawberryfields/ops.py 98.37% <55.55%> (ø)
...rawberryfields/backends/gaussianbackend/backend.py 97.27% <87.5%> (ø)

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 0d1685c...1b35dc5. Read the comment docs.

strawberryfields/backends/base.py Outdated Show resolved Hide resolved
strawberryfields/ops.py Outdated Show resolved Hide resolved
strawberryfields/ops.py Show resolved Hide resolved
strawberryfields/circuitspecs/gaussian.py Show resolved Hide resolved
"""Tests that make use of the Fock basis representation."""

def measure_threshold_gaussian_warning(self, setup_backend):
"""Tests that Threshold measurements are not implemented when shots != 1.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the right docstring?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nop

nquesada and others added 3 commits July 30, 2019 17:34
strawberryfields/backends/base.py Outdated Show resolved Hide resolved
strawberryfields/backends/base.py Outdated Show resolved Hide resolved
strawberryfields/backends/base.py Outdated Show resolved Hide resolved
strawberryfields/ops.py Show resolved Hide resolved
tests/backend/test_threshold_measurement.py Show resolved Hide resolved
tests/backend/test_threshold_measurement.py Show resolved Hide resolved
Copy link
Collaborator Author

@nquesada nquesada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addresses @josh146 comments

@nquesada
Copy link
Collaborator Author

@josh146 any idea what this
image means?

Co-Authored-By: Josh Izaac <josh146@gmail.com>
Copy link
Member

@co9olguy co9olguy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice addition!
I also like how most of these changes are relatively simple, relying on calls to hafnan ahem I mean "The Walrus"

Gave a couple minor suggestions before approval

doc/tutorials/tutorial_boson_sampling.rst Outdated Show resolved Hide resolved
strawberryfields/__init__.py Show resolved Hide resolved
strawberryfields/ops.py Outdated Show resolved Hide resolved
strawberryfields/ops.py Outdated Show resolved Hide resolved
strawberryfields/ops.py Show resolved Hide resolved
tests/backend/test_threshold_measurement.py Show resolved Hide resolved
tests/backend/test_threshold_measurement.py Show resolved Hide resolved
tests/backend/test_threshold_measurement.py Show resolved Hide resolved
Co-Authored-By: Nathan Killoran <co9olguy@users.noreply.github.com>
@josh146 josh146 changed the title Torontonian Adds Torontonian sampling support to the Gaussian backend Aug 12, 2019
@josh146
Copy link
Member

josh146 commented Aug 13, 2019

All looks good from my end now @nquesada

@josh146
Copy link
Member

josh146 commented Aug 13, 2019

As one last commit before merging, can you update the changelog, adding a one-to-two sentence description of the PR to the relevant section, and also link back to the PR.

.github/CHANGELOG.md Outdated Show resolved Hide resolved
strawberryfields/ops.py Outdated Show resolved Hide resolved
Co-Authored-By: Josh Izaac <josh146@gmail.com>
@josh146 josh146 merged commit 08206c0 into master Aug 20, 2019
@josh146 josh146 deleted the torontonian branch August 20, 2019 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants