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

qml.Reflection Operation #5159

Merged
merged 75 commits into from
Mar 5, 2024
Merged

qml.Reflection Operation #5159

merged 75 commits into from
Mar 5, 2024

Conversation

KetpuntoG
Copy link
Contributor

@KetpuntoG KetpuntoG commented Feb 5, 2024

First block of the Amplitude amplification algorithm toolkit project

Example:

@qml.prod
def generator(wires):
    qml.Hadamard(wires=wires)

U = generator(wires=0)

dev = qml.device('default.qubit')

@qml.qnode(dev)
def circuit():

    # Initialize to the state |1>
    qml.qml.PauliX(wires=0)

    # Apply the reflection
    qml.Reflection(U)

    return qml.state()

Copy link
Contributor

github-actions bot commented Feb 5, 2024

Hello. You may have forgotten to update the changelog!
Please edit doc/releases/changelog-dev.md with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

@KetpuntoG
Copy link
Contributor Author

[sc-55958]

@codecov-commenter
Copy link

codecov-commenter commented Feb 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.63%. Comparing base (f9bdb32) to head (352d913).
Report is 6 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5159      +/-   ##
==========================================
- Coverage   99.65%   99.63%   -0.02%     
==========================================
  Files         399      401       +2     
  Lines       36901    36833      -68     
==========================================
- Hits        36774    36700      -74     
- Misses        127      133       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@soranjh soranjh left a comment

Choose a reason for hiding this comment

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

Thanks @KetpuntoG. I left some general comments and questions. Please have a look at other templates, e.g., ControlledSequence, to make this template and its tests consistent with the rest.

pennylane/templates/subroutines/reflection.py Outdated Show resolved Hide resolved
pennylane/templates/subroutines/reflection.py Outdated Show resolved Hide resolved
pennylane/templates/subroutines/reflection.py Outdated Show resolved Hide resolved
pennylane/templates/subroutines/reflection.py Outdated Show resolved Hide resolved
pennylane/templates/subroutines/reflection.py Outdated Show resolved Hide resolved
pennylane/templates/subroutines/reflection.py Outdated Show resolved Hide resolved
tests/templates/test_subroutines/test_reflection.py Outdated Show resolved Hide resolved
pennylane/templates/subroutines/reflection.py Outdated Show resolved Hide resolved
tests/templates/test_subroutines/test_reflection.py Outdated Show resolved Hide resolved
tests/templates/test_subroutines/test_reflection.py Outdated Show resolved Hide resolved
Copy link
Contributor

@soranjh soranjh left a comment

Choose a reason for hiding this comment

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

Thanks @KetpuntoG, looks great. Left some final minor comments.

tests/templates/test_subroutines/test_reflection.py Outdated Show resolved Hide resolved
tests/templates/test_subroutines/test_reflection.py Outdated Show resolved Hide resolved
pennylane/templates/subroutines/reflection.py Outdated Show resolved Hide resolved
pennylane/templates/subroutines/reflection.py Outdated Show resolved Hide resolved
pennylane/templates/subroutines/reflection.py Outdated Show resolved Hide resolved
pennylane/templates/subroutines/reflection.py Outdated Show resolved Hide resolved
pennylane/templates/subroutines/reflection.py Show resolved Hide resolved
pennylane/templates/subroutines/reflection.py Outdated Show resolved Hide resolved
pennylane/templates/subroutines/reflection.py Outdated Show resolved Hide resolved
KetpuntoG and others added 9 commits February 22, 2024 16:30
Co-authored-by: soranjh <40344468+soranjh@users.noreply.github.com>
Co-authored-by: soranjh <40344468+soranjh@users.noreply.github.com>
Co-authored-by: soranjh <40344468+soranjh@users.noreply.github.com>
Co-authored-by: soranjh <40344468+soranjh@users.noreply.github.com>
Co-authored-by: soranjh <40344468+soranjh@users.noreply.github.com>
Co-authored-by: soranjh <40344468+soranjh@users.noreply.github.com>
Co-authored-by: soranjh <40344468+soranjh@users.noreply.github.com>
Copy link
Contributor

@trbromley trbromley left a comment

Choose a reason for hiding this comment

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

Thanks @KetpuntoG!

pennylane/templates/subroutines/reflection.py Show resolved Hide resolved
pennylane/templates/subroutines/reflection.py Outdated Show resolved Hide resolved
KetpuntoG and others added 2 commits February 27, 2024 13:14
Co-authored-by: Thomas R. Bromley <49409390+trbromley@users.noreply.github.com>
Copy link
Contributor

@soranjh soranjh left a comment

Choose a reason for hiding this comment

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

Thanks @KetpuntoG , looks good!

pennylane/templates/subroutines/reflection.py Outdated Show resolved Hide resolved
pennylane/templates/subroutines/reflection.py Outdated Show resolved Hide resolved
Copy link
Contributor

@trbromley trbromley left a comment

Choose a reason for hiding this comment

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

Thanks @KetpuntoG! I still have a few more comments, but overall this is looking great.

doc/releases/changelog-dev.md Show resolved Hide resolved
pennylane/templates/subroutines/reflection.py Outdated Show resolved Hide resolved
pennylane/templates/subroutines/reflection.py Show resolved Hide resolved
pennylane/templates/subroutines/reflection.py Show resolved Hide resolved
pennylane/templates/subroutines/reflection.py Show resolved Hide resolved
KetpuntoG and others added 4 commits March 5, 2024 10:16
Co-authored-by: soranjh <40344468+soranjh@users.noreply.github.com>
Co-authored-by: soranjh <40344468+soranjh@users.noreply.github.com>
Co-authored-by: Diego <67476785+DSGuala@users.noreply.github.com>
Copy link
Contributor

@DSGuala DSGuala left a comment

Choose a reason for hiding this comment

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

Looks good! Approved from my side.

@KetpuntoG KetpuntoG merged commit fb9ad8c into master Mar 5, 2024
40 checks passed
@KetpuntoG KetpuntoG deleted the ReflectionOperation branch March 5, 2024 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants