-
Notifications
You must be signed in to change notification settings - Fork 214
Add tutorial on Quantum Phase Estimation #535
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
Conversation
Thank you for opening this pull request. You can find the built site at this link. Deployment Info:
Note: It may take several minutes for updates to this pull request to be reflected on the deployed site. |
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 is a first round of comments. It looks good!
There are still things to correct 😄
be careful with taking for granted things that the reader does not have to know
demonstrations/tutorial_qpe.py
Outdated
@@ -0,0 +1,803 @@ | |||
""" | |||
Title: Quantum Phase Estimation for molecular energies Date: 2022-07-25 |
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.
|
||
###################################################################### | ||
# Hi! It seems that you were wandering around the PennyLane website and | ||
# opened the demo called “Finding Ground State Energies via Quantum Phase |
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.
The name that appears in the website is "Relating energies to quantum phases". I think when you change the title format it will fix itself.
ax.set_xlabel("Readout bitstring index ($l$)") | ||
ax.set_ylabel(r"Measurement probability ($\left|\alpha_l\right|^2$)") | ||
ax.legend() | ||
|
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.
Write plt.show() to avoid warnings.
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.
Also the xkcd fonts are not found and generating an error for me.
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.
The orange line in this plot is hard to see
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.
And the axis label is cut off.
# determinants with different number of electrons. | ||
# | ||
# Altogether all this completely spoils the estimate of the QPE circuit | ||
# even for a simple system as H\ :math:`_3^{+}` :/. On the other hand the |
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.
you can use emojis if you want haha 🤨😮🤯
ax.set_yscale('log') | ||
|
||
|
||
###################################################################### |
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.
Image appears cropped
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.
Perhaps connecting the dots with a line would make it clearer. The first time I didn't see the bottom dot 🙈
demonstrations/tutorial_qpe.py
Outdated
# | ||
|
||
###################################################################### | ||
# [1] If not, no worries, but briefly yes, we hope that the |
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.
In the demos, the footers do not look good 😅 Try to insert them in the text or simply remove them
demonstrations/tutorial_qpe.py
Outdated
|
||
|
||
###################################################################### | ||
# {% from ‘author_bio.html’ import author_bio %} {{ |
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.
the bio is put differently, look at this example. Also, for the authors the image is saved in another folder
Co-authored-by: Guillermo Alonso-Linaje <65235481+KetpuntoG@users.noreply.github.com>
Co-authored-by: Guillermo Alonso-Linaje <65235481+KetpuntoG@users.noreply.github.com>
Co-authored-by: Guillermo Alonso-Linaje <65235481+KetpuntoG@users.noreply.github.com>
Co-authored-by: Guillermo Alonso-Linaje <65235481+KetpuntoG@users.noreply.github.com>
Co-authored-by: Guillermo Alonso-Linaje <65235481+KetpuntoG@users.noreply.github.com>
Co-authored-by: Guillermo Alonso-Linaje <65235481+KetpuntoG@users.noreply.github.com>
Co-authored-by: Guillermo Alonso-Linaje <65235481+KetpuntoG@users.noreply.github.com>
""" | ||
###################################################################### | ||
# | ||
# Hi! It seems that you were wandering around the PennyLane website and |
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.
I like a casual introduction but I think this will read a little oddly to most people who arrive here as only a minority get here from the website; most come via links from twitter and so on.
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.
Agree!
# 1. Quantum computers will make finding the ground state energies easier. | ||
# 2. The quantum phase estimation (QPE) algorithm should be somehow involved there — and you are keen to learn how ground state energies and QPE go together. | ||
# | ||
# Well, in this case you |
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.
# Well, in this case you | |
# |
# In the next section we will go greedy and will look at the accuracy | ||
# improvements that we can get by adding more qubits in the readout | ||
# register :3! | ||
# |
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.
I'm confused, why use QPE after VQE, if VQE already gave us something very precise? I don't understand the point of this whole exercise much! Could you clarify?
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.
Hi @alvaro-at-xanadu! I've added a small explanation on this point. I agree that for this particular case it is pointless to use the QPE after the VQE which is already giving the exact answer. On the other hand for the demo should be clarifying because corresponds to the textbook case where we are using the exact eigenstate as input for the QPE.
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.
I learned a lot from this demo! 💯 But to be production-quality, it still needs several changes:
- There's an incomplete section
- Typos and grammar, acronyms
- Some parts require more explanation. Mostly the initial QPE code, the use of QPE after VQE.
- Code needs more comments
Please do not click on resolve conversation in any of the comments. Only reviewers will do this. If you need to implement a suggestion, click on commit suggestion
. And if you've already fixed some of these locally, please don't forget to push the latest version as you do!
@Exferro @davidecast , could you work on the requested changes? |
Co-authored-by: alvaro-at-xanadu <91897656+alvaro-at-xanadu@users.noreply.github.com>
Co-authored-by: alvaro-at-xanadu <91897656+alvaro-at-xanadu@users.noreply.github.com>
Co-authored-by: alvaro-at-xanadu <91897656+alvaro-at-xanadu@users.noreply.github.com>
Co-authored-by: alvaro-at-xanadu <91897656+alvaro-at-xanadu@users.noreply.github.com>
Hey @KetpuntoG! Sorry for keeping postponing! |
Let's try to finish this soon in January :) |
@Exferro @davidecast please do not leave this |
Hi @KetpuntoG! Sorry for replying late and that we are dragging our last fixes, I will work on the remaining changes requested in the next days and then @Exferro will go on from there. |
Co-authored-by: Alvaro Ballon <91897656+alvaro-at-xanadu@users.noreply.github.com>
Co-authored-by: Alvaro Ballon <91897656+alvaro-at-xanadu@users.noreply.github.com>
Co-authored-by: Alvaro Ballon <91897656+alvaro-at-xanadu@users.noreply.github.com>
Co-authored-by: Alvaro Ballon <91897656+alvaro-at-xanadu@users.noreply.github.com>
Co-authored-by: Alvaro Ballon <91897656+alvaro-at-xanadu@users.noreply.github.com>
Co-authored-by: Alvaro Ballon <91897656+alvaro-at-xanadu@users.noreply.github.com>
Co-authored-by: Alvaro Ballon <91897656+alvaro-at-xanadu@users.noreply.github.com>
Co-authored-by: Alvaro Ballon <91897656+alvaro-at-xanadu@users.noreply.github.com>
Co-authored-by: Alvaro Ballon <91897656+alvaro-at-xanadu@users.noreply.github.com>
Co-authored-by: Alvaro Ballon <91897656+alvaro-at-xanadu@users.noreply.github.com>
Co-authored-by: Alvaro Ballon <91897656+alvaro-at-xanadu@users.noreply.github.com>
Co-authored-by: Alvaro Ballon <91897656+alvaro-at-xanadu@users.noreply.github.com>
Co-authored-by: Alvaro Ballon <91897656+alvaro-at-xanadu@users.noreply.github.com>
A new QPE demo with the new PL features is on the way. I close this PR as it is not expected to be merged |
Before submitting
Please complete the following checklist when submitting a PR:
Ensure that your tutorial executes correctly, and conforms to the
guidelines specified in the README.
Add a thumbnail link to your tutorial in
beginner.rst
, or if aQML implementation, in
implementations.rst
.All QML tutorials conform to
PEP8 standards.
To auto format files, simply
pip install black
, and thenrun
black -l 100 path/to/file.py
.When all the above are checked, delete everything above the dashed
line and fill in the pull request template.
Title: Quantum Phase Estimation for Molecular Ground State Energies
Summary:
Relevant references:
Possible Drawbacks:
Related GitHub Issues: