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 functionality iterative_qpe #4804

Merged
merged 31 commits into from Nov 21, 2023
Merged

Adding functionality iterative_qpe #4804

merged 31 commits into from Nov 21, 2023

Conversation

KetpuntoG
Copy link
Contributor

Adding functionality iterative_qpe

Copy link
Contributor

github-actions bot commented Nov 7, 2023

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.

Copy link

codecov bot commented Nov 8, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (1f47116) 99.65% compared to head (5f63e0f) 99.64%.
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4804      +/-   ##
==========================================
- Coverage   99.65%   99.64%   -0.01%     
==========================================
  Files         382      383       +1     
  Lines       34500    34253     -247     
==========================================
- Hits        34380    34132     -248     
- Misses        120      121       +1     

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

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.

Amazing work! Looks pretty much good to go. I left some stylistic comments. The only other thing I can think to add if we have time would be one integration test which tests a full workflow like: given a hamiltonian compute its ground state energy using IQPE.

Other than that, once the comments are addressed I am happy to approve 💯

doc/releases/changelog-dev.md Show resolved Hide resolved
doc/releases/changelog-dev.md Outdated Show resolved Hide resolved
pennylane/ops/functions/__init__.py Show resolved Hide resolved
pennylane/ops/functions/iterative_qpe.py Outdated Show resolved Hide resolved
tests/ops/functions/test_iterative_qpe.py Outdated Show resolved Hide resolved
tests/ops/functions/test_iterative_qpe.py Outdated Show resolved Hide resolved
pennylane/ops/functions/iterative_qpe.py Outdated Show resolved Hide resolved
pennylane/ops/functions/iterative_qpe.py Outdated Show resolved Hide resolved
pennylane/ops/functions/iterative_qpe.py Outdated Show resolved Hide resolved
pennylane/ops/functions/iterative_qpe.py Show resolved Hide resolved
Jaybsoni and others added 6 commits November 8, 2023 12:29
Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca>
Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca>
Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca>
Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca>
Copy link
Contributor

@mudit2812 mudit2812 left a comment

Choose a reason for hiding this comment

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

Thanks Guillermo! Such an exciting feature 😄 . Just one comment about testing gradients with other interfaces, but otherwise looks good. Once addressed, I'm ready to approve 🚀

pennylane/ops/functions/iterative_qpe.py Show resolved Hide resolved
tests/ops/functions/test_iterative_qpe.py Show resolved Hide resolved
@KetpuntoG
Copy link
Contributor Author

I've added test for tensorflow and torch.
It has been identified a bug, so the tests will not pass until it is solved:
This is the issue:

#4825

Co-authored-by: Tom Bromley <49409390+trbromley@users.noreply.github.com>
@Jaybsoni
Copy link
Contributor

[sc-45848]

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.

Just some stylistic comments, otherwise I think this is good to go! I am approving for now, feel free to merge once the comments are resolved!

doc/releases/changelog-dev.md Show resolved Hide resolved
doc/releases/changelog-dev.md Outdated Show resolved Hide resolved
pennylane/ops/functions/iterative_qpe.py Show resolved Hide resolved
pennylane/ops/functions/iterative_qpe.py Outdated Show resolved Hide resolved
tests/ops/functions/test_iterative_qpe.py Show resolved Hide resolved
pennylane/ops/functions/iterative_qpe.py Outdated Show resolved Hide resolved
pennylane/ops/functions/iterative_qpe.py Outdated Show resolved Hide resolved
pennylane/ops/functions/iterative_qpe.py Outdated Show resolved Hide resolved
KetpuntoG and others added 4 commits November 20, 2023 12:51
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

@mudit2812 mudit2812 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, just one question but otherwise I'm ready to approve :)

tests/ops/functions/test_iterative_qpe.py Show resolved Hide resolved
Copy link
Contributor

@mudit2812 mudit2812 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 merged commit bea3682 into master Nov 21, 2023
33 checks passed
@KetpuntoG KetpuntoG deleted the IQPE branch November 21, 2023 19:15
>>> print(qml.draw(circuit)())

1: ──H─╭●────────────H──┤↗│ │0⟩──H─╭●────────────Rϕ(-1.57)──H──┤↗│ │0⟩──H─╭●────────────Rϕ(-1.57)──Rϕ(-0.79)──H──┤↗│ │0⟩─┤ Sample Sample Sample
0: ──X─╰RZ(2.00)⁴⋅⁰──────║──────────╰RZ(2.00)²⋅⁰──║──────────────║──────────╰RZ(2.00)¹⋅⁰──║──────────║──────────────────────┤
Copy link
Contributor

Choose a reason for hiding this comment

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

@KetpuntoG

RZ(2.00)⁴⋅⁰

Is this 4.0 because the power is a float?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch! This was something we modified at the end to work with torch instead of tensorflow.
It is an integer. It is updated in this PR

https://github.com/PennyLaneAI/pennylane/pull/4871/files

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

5 participants