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

Quadrature methods for circuit components and states #443

Merged
merged 37 commits into from
Aug 30, 2024

Conversation

elib20
Copy link
Contributor

@elib20 elib20 commented Jul 24, 2024

Context: We would like convenience methods for evaluating the quadrature basis representation of circuit components and states.

Description of the Change:

  • renames the quadrature method for circuit components to quadrature_triple
  • adds a new to_quadrature method to convert to the quadrature representation from Bargmann
  • adds a new quadrature method for circuit components to evaluate the quadrature basis function over an array of points. This works for Bargmann and Fock representations, batched or unbatched.
  • adds a new quadrature_distribution method for Ket and DM to evaluate the quadrature basis probability distribution over an array of points. This works for Bargmann and Fock representations, batched or unbatched.

Benefits:

  • Convenient methods for users
  • Quadrature methods now work for Fock representation

Possible Drawbacks:
None

Related GitHub Issues:

@elib20 elib20 added the no changelog Pull request does not require a CHANGELOG entry label Jul 24, 2024
@elib20 elib20 requested review from ziofil and apchytr July 24, 2024 22:19
@elib20 elib20 marked this pull request as ready for review July 24, 2024 22:19
Copy link

codecov bot commented Jul 24, 2024

Codecov Report

Attention: Patch coverage is 98.41270% with 1 line in your changes missing coverage. Please review.

Project coverage is 89.52%. Comparing base (92e42e3) to head (bc4c44c).
Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
mrmustard/lab_dev/circuit_components.py 95.45% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #443      +/-   ##
===========================================
+ Coverage    89.47%   89.52%   +0.04%     
===========================================
  Files          102      102              
  Lines         7365     7408      +43     
===========================================
+ Hits          6590     6632      +42     
- Misses         775      776       +1     
Files with missing lines Coverage Δ
mrmustard/lab_dev/states/base.py 96.26% <100.00%> (+0.13%) ⬆️
mrmustard/physics/fock.py 92.94% <100.00%> (+0.38%) ⬆️
mrmustard/lab_dev/circuit_components.py 99.08% <95.45%> (-0.28%) ⬇️

Continue to review full report in Codecov by Sentry.

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

mrmustard/physics/fock.py Outdated Show resolved Hide resolved
@ziofil ziofil marked this pull request as draft August 15, 2024 20:32
@ziofil
Copy link
Collaborator

ziofil commented Aug 23, 2024

Maybe it's late for this suggestions, but wouldn't it be sufficient to apply BtoQ on all wires and return the ansatz? Then the ansatz itself can be called independently.

@elib20 elib20 marked this pull request as ready for review August 26, 2024 18:30
mrmustard/lab_dev/circuit_components.py Outdated Show resolved Hide resolved
mrmustard/physics/fock.py Outdated Show resolved Hide resolved
mrmustard/physics/fock.py Outdated Show resolved Hide resolved
mrmustard/physics/fock.py Outdated Show resolved Hide resolved
@ziofil
Copy link
Collaborator

ziofil commented Aug 27, 2024

I approved it, but make sure those indices are in the right order

@elib20 elib20 merged commit d6e0d9d into develop Aug 30, 2024
7 checks passed
@elib20 elib20 deleted the state-qudrature-method branch August 30, 2024 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no changelog Pull request does not require a CHANGELOG entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants