-
Notifications
You must be signed in to change notification settings - Fork 218
Demo: How to use PennyLane for Resource Estimation #1592
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
base: dev
Are you sure you want to change the base?
Conversation
|
👋 Hey, looks like you've updated some demos! 🐘 Don't forget to update the Please hide this comment once the field(s) are updated. Thanks! |
demonstrations_v2/re_how_to_use_pennylane_for_resource_estimation/demo.py
Outdated
Show resolved
Hide resolved
After the update to Sphinx, Sphinx Gallery now outputs a different format for generated code blocks, where the code block is now part of an entirely separate element and no longer nested in `rst-class` directive. This PR adds a fix to be able to handle both the new and old `sphx-glr-script-out` formats. It has been tested on #1592 .
Your preview is ready 🎉!You can view your changes here
|
josh146
left a comment
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.
demonstrations_v2/re_how_to_use_pennylane_for_resource_estimation/demo.py
Outdated
Show resolved
Hide resolved
demonstrations_v2/re_how_to_use_pennylane_for_resource_estimation/demo.py
Outdated
Show resolved
Hide resolved
demonstrations_v2/re_how_to_use_pennylane_for_resource_estimation/demo.py
Outdated
Show resolved
Hide resolved
demonstrations_v2/re_how_to_use_pennylane_for_resource_estimation/demo.py
Outdated
Show resolved
Hide resolved
demonstrations_v2/re_how_to_use_pennylane_for_resource_estimation/demo.py
Outdated
Show resolved
Hide resolved
demonstrations_v2/re_how_to_use_pennylane_for_resource_estimation/demo.py
Outdated
Show resolved
Hide resolved
| def circuit(hamiltonian, num_steps, order): | ||
| qre.UniformStatePrep(num_states=2**n_q) # uniform superposition over all basis states | ||
| qre.TrotterPauli(hamiltonian, num_steps, order) |
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.
Something I think is worth emphasizing to the reader is that this circuit is not executable (e.g., you could show them what happens when they execute this function --- I assume nothing, and compare it to what happens when you execute executable_circuit).
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 agree with your suggestion Josh! However the system size we have selected are already non-executable. Even the executable circuit has 1250 wires which we cannot hope to execute on simulator.
demonstrations_v2/re_how_to_use_pennylane_for_resource_estimation/demo.py
Outdated
Show resolved
Hide resolved
demonstrations_v2/re_how_to_use_pennylane_for_resource_estimation/demo.py
Outdated
Show resolved
Hide resolved
| ###################################################################### | ||
| # Your turn! | ||
| # ~~~~~~~~~~ | ||
| # | ||
| # Now that you’ve seen how powerful PennyLane’s | ||
| # quantum resource :mod:`estimator <pennylane.estimator>` is, | ||
| # go try it out yourself! | ||
| # | ||
| # Use PennyLane to reason about the costs of your quantum algorithm | ||
| # without any of the headaches. |
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 wonder if there is something more explicit to put here in the concluding call-to-action. As it is currently worded, it isn't really saying much that hasn't already been said earlier on in the demo.
Perhaps this is the place to mention some of the other features of the estimation module, point to specs, etc?
| # without any of the headaches. | ||
| # | ||
| # References | ||
| # ---------- |
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.
| # ---------- | |
| # ~~~~~~~~~~ |
| r"""How to use PennyLane for Resource Estimation | ||
| ============================================ | ||
|
|
||
| Fault tolerant quantum computers are on their way. But how do we ensure that useful algorithms can |
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.
| Fault tolerant quantum computers are on their way. But how do we ensure that useful algorithms can | |
| Fault-tolerant quantum computers are on their way. However, how do we ensure that useful algorithms can |
| ============================================ | ||
|
|
||
| Fault tolerant quantum computers are on their way. But how do we ensure that useful algorithms can | ||
| actually run on them? An algorithm is hardly helpful when it cannot be executed; but only truly |
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.
| actually run on them? An algorithm is hardly helpful when it cannot be executed; but only truly | |
| actually run on them? An algorithm is hardly helpful when it cannot be executed, but only truly |
josh146
left a comment
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.
| to execute on a given quantum hardware architecture, or if it will even fit in memory to begin with. | ||
|
|
||
| PennyLane is here to make that process easy, with our new resource estimation module | ||
| :mod:`estimator <pennylane.estimator>`. `estimator` leverages the latest resource estimates, |
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.
| :mod:`estimator <pennylane.estimator>`. `estimator` leverages the latest resource estimates, | |
| :mod:`estimator <pennylane.estimator>`. ``estimator`` leverages the latest resource estimates, |
| quickly as possible. | ||
|
|
||
| In this demo, we will estimate the quantum resources necessary for a simple Hamiltonian workflow: | ||
| evolve the quantum state of a honeycomb lattice of spins under 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.
| evolve the quantum state of a honeycomb lattice of spins under the | |
| evolving the quantum state of a honeycomb lattice of spins under the |
| # **Thats 20,000 spins!** | ||
| # | ||
| # Generating such Hamiltonians quickly becomes a bottleneck. | ||
| # However, :mod:`estimator <pennylane.estimator>`, |
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.
| # However, :mod:`estimator <pennylane.estimator>`, | |
| # However, :mod:`estimator <pennylane.estimator>` |
| # from the :mod:`estimator <pennylane.estimator>` module to express our circuit. | ||
| # These | ||
| # :class:`ResourceOperator <pennylane.estimator.resource_operator.ResourceOperator>` | ||
| # classes, like the `PauliHamiltonian` above, are designed to require minimal information |
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.
| # classes, like the `PauliHamiltonian` above, are designed to require minimal information | |
| # classes, like the ``PauliHamiltonian`` above, are designed to require minimal information |
| print(res) | ||
|
|
||
| ###################################################################### | ||
| # Our resource estimate was generated in the blink of an eye. |
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.
| # Our resource estimate was generated in the blink of an eye. | |
| # Our resource estimate was generated in the blink of an eye 👁️ |
optional!
| ) | ||
|
|
||
| ###################################################################### | ||
| # Let’s see how the cost of ``qre.TrotterPauli`` differs in these two cases! |
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.
| # Let’s see how the cost of ``qre.TrotterPauli`` differs in these two cases! | |
| # Let’s see how the cost of ``qre.TrotterPauli`` differs in these two cases: |
| # References | ||
| # ---------- |
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.
| # References | |
| # ---------- | |
| # References | |
| # ~~~~~~~~~~ |
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.
Remember to do a grammar check of the content you include.
All 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:
Summary:
Relevant references:
Possible Drawbacks:
Related GitHub Issues:
If you are writing a demonstration, please answer these questions to facilitate the marketing process.
GOALS — Why are we working on this now?
Eg. Promote a new PL feature or show a PL implementation of a recent paper.
AUDIENCE — Who is this for?
Eg. Chemistry researchers, PL educators, beginners in quantum computing.
KEYWORDS — What words should be included in the marketing post?
Which of the following types of documentation is most similar to your file?
(more details here)