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

Adding a bunch of gates from the lab #520

Open
wants to merge 22 commits into
base: develop
Choose a base branch
from

Conversation

arsalan-motamedi
Copy link
Collaborator

@arsalan-motamedi arsalan-motamedi commented Nov 6, 2024

Context:
There are many interesting things implemented in the old lab which are still missing in lab_dev.

Description of the Change:
We add the following gates:

  • Pgate: the quadratic phase gate
  • CXgate and CZgate: the controlled-X and -Z gates
  • MZgate: Mach-Zehnder gate
  • Interferometer and RealInterferometer

Also, we add the BargmannEigenstate which are simply unnormalized coherent states.

Benefits:
More things to have ready!

Possible Drawbacks:
None.

Related GitHub Issues:
None.

@arsalan-motamedi arsalan-motamedi added the no changelog Pull request does not require a CHANGELOG entry label Nov 6, 2024
Copy link

codecov bot commented Nov 6, 2024

Codecov Report

Attention: Patch coverage is 83.68421% with 31 lines in your changes missing coverage. Please review.

Project coverage is 89.63%. Comparing base (f3c226d) to head (fe9b982).

Files with missing lines Patch % Lines
mrmustard/physics/triples.py 35.71% 18 Missing ⚠️
mrmustard/lab_dev/states/gstate.py 56.66% 13 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #520      +/-   ##
===========================================
- Coverage    89.81%   89.63%   -0.19%     
===========================================
  Files           93      101       +8     
  Lines         6098     6288     +190     
===========================================
+ Hits          5477     5636     +159     
- Misses         621      652      +31     
Files with missing lines Coverage Δ
mrmustard/lab_dev/states/__init__.py 100.00% <100.00%> (ø)
mrmustard/lab_dev/states/bargmann_eigenstate.py 100.00% <100.00%> (ø)
mrmustard/lab_dev/states/ket.py 98.59% <ø> (ø)
mrmustard/lab_dev/transformations/__init__.py 100.00% <100.00%> (ø)
mrmustard/lab_dev/transformations/cxgate.py 100.00% <100.00%> (ø)
mrmustard/lab_dev/transformations/czgate.py 100.00% <100.00%> (ø)
...rmustard/lab_dev/transformations/interferometer.py 100.00% <100.00%> (ø)
mrmustard/lab_dev/transformations/mzgate.py 100.00% <100.00%> (ø)
mrmustard/lab_dev/transformations/pgate.py 100.00% <100.00%> (ø)
...tard/lab_dev/transformations/realinterferometer.py 100.00% <100.00%> (ø)
... and 2 more

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 f3c226d...fe9b982. Read the comment docs.

---- 🚨 Try these New Features:

Copy link
Collaborator

@apchytr apchytr left a comment

Choose a reason for hiding this comment

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

Some initial comments. Thanks Arsalan!

mrmustard/lab_dev/states/bargmanneigenstate.py Outdated Show resolved Hide resolved
mrmustard/lab_dev/states/bargmanneigenstate.py Outdated Show resolved Hide resolved
mrmustard/lab_dev/states/bargmanneigenstate.py Outdated Show resolved Hide resolved
mrmustard/lab_dev/transformations/cxgate.py Outdated Show resolved Hide resolved
)
super().__init__(name="CXgate")
self._add_parameter(make_parameter(s_trainable, s, "s", s_bounds))
symplectic = math.astensor(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should you override the symplectic property?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I guess so.. I will take a look at Ggate to see how it's done

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Actually no, I think it is characterized by other parameters (here it is just s). So, I believe we don't want to have it as a property.

mrmustard/lab_dev/transformations/czgate.py Outdated Show resolved Hide resolved
mrmustard/lab_dev/transformations/pgate.py Outdated Show resolved Hide resolved
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.

2 participants