-
Notifications
You must be signed in to change notification settings - Fork 211
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
PR for Issue #134 Unitary Hack #138
PR for Issue #134 Unitary Hack #138
Conversation
torchquantum/functional.py
Outdated
@@ -1168,6 +1169,9 @@ def singleexcitation_matrix(params): | |||
), | |||
"ecr": torch.tensor( | |||
[[0, 0, 1, 1j], [0, 0, 1j, 1], [1, -1j, 0, 0], [-1j, 1, 0, 0]], dtype=C_DTYPE | |||
), | |||
"sdg": torch.tensor( | |||
[[1 + 0j, 0 + 0j],[0 + 0j, -0 - 1j]], dtype=C_DTYPE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you change this to [[1, 0], [0, -1j]] for better readability?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure!
torchquantum/functional.py
Outdated
inverse: bool = False, | ||
comp_method: str = "bmm", | ||
): | ||
"""Perform the hadamard gate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here should be the sdg gate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, sorry
I've made the necessary modifications @Hanrui-Wang ; does the current PR appear to be satisfactory? Should I keep adding gates in this format? Could you also please assign me Issue #134? |
79cf688
to
530c1a6
Compare
Hello @Hanrui-Wang, I have added 3 more gates TDG, SXDG and CH. |
Hi Soham, the added gates looks good, thank you for your contributions! could you pull request to the dev branch? |
Sure @Hanrui-Wang , I'll PR to the dev branch |
I changed the base branch to dev, but I think some of the previous commits from the repo also got added to my PR |
Hi @Hanrui-Wang just updating you regarding my progress, Non-Parameterized Gates:
Parameterized Gates:
I believe I have covered the majority of the missing gates, but I'll continue to look for additional ones. Further Work: Adding more ansatz layers(EfficientSU2, RealAmplitudes, etc.) and NLocal circuits. |
fix r gate in dict
Thank you @bopardikarsoham for your contributions! |
Hello, @Hanrui-Wang. I added a sample PR to the codebase by adding the SDG gate. I intend to add more, but first I'd like you to check if I did everything right. As described in Issue #134, I put the sdg matrix to the matrix dictionary in functional.py and wrote a function for the gate. Next, I added the sdg class to the operators.py file, and finally, I added the sdg gate to the test_op.py file.