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 34 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 99.52381% with 1 line in your changes missing coverage. Please review.

Project coverage is 90.11%. Comparing base (4c603d0) to head (0af0a16).

Files with missing lines Patch % Lines
mrmustard/lab_dev/transformations/ggate.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #520      +/-   ##
===========================================
+ Coverage    89.84%   90.11%   +0.26%     
===========================================
  Files           93      101       +8     
  Lines         6098     6291     +193     
===========================================
+ Hits          5479     5669     +190     
- Misses         619      622       +3     
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/gstate.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%> (ø)
... and 9 more

... and 1 file with indirect coverage changes


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 4c603d0...0af0a16. Read the comment docs.

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
@Rahps97
Copy link

Rahps97 commented Nov 20, 2024

Hi,
Sorry for a newbie question. I was looking for a Kerr gate (need to implement non-linear operation). Any suggestions?

mrmustard/lab_dev/states/gstate.py Show resolved Hide resolved

.. math::

C_Z = \exp(ig q_1 \otimes q_2 / \hbar).
Copy link
Collaborator

Choose a reason for hiding this comment

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

is g the same as s? should we use the same letter if they are the same?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, they are the same thing. I will make this change

Copy link
Collaborator

@ziofil ziofil left a comment

Choose a reason for hiding this comment

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

great!

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.

4 participants