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 QROM template #5688

Merged
merged 48 commits into from
Jun 6, 2024
Merged

Adding QROM template #5688

merged 48 commits into from
Jun 6, 2024

Conversation

KetpuntoG
Copy link
Contributor

@KetpuntoG KetpuntoG commented May 14, 2024

Template for QROM, a technique to embed classical data on a quantum computer
Code example:

 bitstrings = ["010", "111", "110", "000"]

   dev = qml.device("default.qubit", shots = 1)
   @qml.qnode(dev)
   def circuit():

     # third index
     qml.BasisEmbedding(2, wires = [0,1])

     qml.QROM(b = bitstrings,
             control_wires = [0,1],
             target_wires = [2,3,4],
             work_wires = [5,6,7])

     return qml.sample(wires = [2,3,4])
>>> print(circuit())
[1 1 0]

Copy link
Contributor

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-62853]

Copy link

codecov bot commented May 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.66%. Comparing base (087c1c8) to head (aadc12c).
Report is 252 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5688      +/-   ##
==========================================
- Coverage   99.66%   99.66%   -0.01%     
==========================================
  Files         414      415       +1     
  Lines       39490    39305     -185     
==========================================
- Hits        39358    39172     -186     
- Misses        132      133       +1     

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

@KetpuntoG KetpuntoG changed the title [WIP] Adding QROM template Adding QROM template May 17, 2024
@DSGuala DSGuala self-requested a review May 28, 2024 18:06
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. Added my final comments, will approve when they are addressed.

pennylane/templates/subroutines/qrom.py Outdated Show resolved Hide resolved
pennylane/templates/subroutines/qrom.py Show resolved Hide resolved
pennylane/templates/subroutines/qrom.py Outdated Show resolved Hide resolved
pennylane/templates/subroutines/qrom.py Outdated Show resolved Hide resolved
pennylane/templates/subroutines/qrom.py Outdated Show resolved Hide resolved
pennylane/templates/subroutines/qrom.py Show resolved Hide resolved
pennylane/templates/subroutines/qrom.py Outdated Show resolved Hide resolved
tests/templates/test_subroutines/test_qrom.py Outdated Show resolved Hide resolved
tests/templates/test_subroutines/test_qrom.py Outdated Show resolved Hide resolved
tests/templates/test_subroutines/test_qrom.py Outdated Show resolved Hide resolved
Copy link
Contributor

@Jaybsoni Jaybsoni left a comment

Choose a reason for hiding this comment

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

Looks very good, I left a few suggestions and comments! I know that this template doesn't have any trainable parameters, but we should still check that it is jit-able.

happy to review again once you have addressed the comments. Should be good to go soon!

pennylane/templates/subroutines/qrom.py Show resolved Hide resolved
pennylane/templates/subroutines/qrom.py Show resolved Hide resolved
pennylane/templates/subroutines/qrom.py Outdated Show resolved Hide resolved
pennylane/templates/subroutines/qrom.py Show resolved Hide resolved
pennylane/templates/subroutines/qrom.py Outdated Show resolved Hide resolved
pennylane/templates/subroutines/qrom.py Show resolved Hide resolved
pennylane/templates/subroutines/qrom.py Outdated Show resolved Hide resolved
pennylane/templates/subroutines/qrom.py Outdated Show resolved Hide resolved
KetpuntoG and others added 3 commits June 4, 2024 15:51
suggestions from code review

Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca>
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!

KetpuntoG and others added 3 commits June 5, 2024 11:34
[skip-ci]

Co-authored-by: David Wierichs <david.wierichs@xanadu.ai>
@KetpuntoG KetpuntoG requested a review from soranjh June 5, 2024 17:12
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.

Looks good @KetpuntoG, ready to go.

pennylane/templates/subroutines/qrom.py Outdated Show resolved Hide resolved
pennylane/templates/subroutines/qrom.py Outdated Show resolved Hide resolved
KetpuntoG and others added 3 commits June 5, 2024 18:49
Copy link
Contributor

@Jaybsoni Jaybsoni left a comment

Choose a reason for hiding this comment

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

Great work! Just a few, non-blocking comments

@KetpuntoG KetpuntoG merged commit 38b3e74 into master Jun 6, 2024
40 checks passed
@KetpuntoG KetpuntoG deleted the qrom_template branch June 6, 2024 17:07
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.

6 participants