Skip to content

Conversation

@AntonNI8
Copy link
Contributor

@AntonNI8 AntonNI8 commented Oct 31, 2025

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 then
    run 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)

  • Tutorial
  • Demo
  • How-to

@github-actions
Copy link

👋 Hey, looks like you've updated some demos!

🐘 Don't forget to update the dateOfLastModification in the associated metadata files so your changes are reflected in Glass Onion (search and recommendations).

Please hide this comment once the field(s) are updated. Thanks!

@AntonNI8 AntonNI8 changed the base branch from master to filter-fix November 14, 2025 22:26
doctorperceptron added a commit that referenced this pull request Nov 17, 2025
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 .
Base automatically changed from filter-fix to master November 17, 2025 14:23
@github-actions
Copy link

github-actions bot commented Nov 17, 2025

Your preview is ready 🎉!

You can view your changes here

Deployed at: 2025-11-28 17:18:13 UTC

Comment on lines 7 to 14
# Fault tolerant quantum computing is on its way. But are there useful algorithms which are ready for
# it? The development of meaningful applications of quantum computing is an active area of research,
# and one of the major challenges in the process of assessing a potential quantum algorithm is
# determining the amount of resources required to execute it on hardware. An algorithm may still be
# helpful even when it cannot be executed, but is only truly helpful when it can.
#
# PennyLane is here to make that process easy, with our new resource estimation module:
# `pennylane.estimator <https://docs.pennylane.ai/en/latest/code/qml_estimator.html>`__.
Copy link
Contributor

@DSGuala DSGuala Nov 21, 2025

Choose a reason for hiding this comment

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

Spent some time thinking of alternatives and suggestions. Not an improvement, but sharing in case it's useful or sparks ideas ✨ 💡 ✨

Suggested change
# Fault tolerant quantum computing is on its way. But are there useful algorithms which are ready for
# it? The development of meaningful applications of quantum computing is an active area of research,
# and one of the major challenges in the process of assessing a potential quantum algorithm is
# determining the amount of resources required to execute it on hardware. An algorithm may still be
# helpful even when it cannot be executed, but is only truly helpful when it can.
#
# PennyLane is here to make that process easy, with our new resource estimation module:
# `pennylane.estimator <https://docs.pennylane.ai/en/latest/code/qml_estimator.html>`__.
# Fault tolerant quantum computers are on their way. But do we have useful algorithms to run on them?
# Answering this question is a major challenge of quantum algorithm development. It involves
# calculating algorithmic gate requirements to ensure reasonable runtimes and determining qubit
# requirements to ensure they fit in a quantum computer's memory.
#
# PennyLane is here to make that process easy, with our new resource estimation module:
# `pennylane.estimator <https://docs.pennylane.ai/en/latest/code/qml_estimator.html>`__.

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.

Nice! Overall comments for now are that I think the demo could be more compact and some polishing is pending. Left several comments which hopefully help with this 🤞

Copy link
Member

@josh146 josh146 left a comment

Choose a reason for hiding this comment

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

Nice work @AntonNI8! I read through and left some comments.

At a high level, my main comment is that the flow/story can be adjusted and tightened somewhat.

  • The introduction can be reduced, and made sure to emphasize what the how-to demo is going to show the reader to do.

  • The first section (with the timing of the hamiltonian computation) I find a bit distracting/doesn't quite fit. As a reader looking for 'how to do resource estimation', I've already decided to do resource estimation -- so no need to motivate it to me from the point of avoiding hamiltonian construction! However this section is still quite nice, so could be kept as an appendix.

  • For the overall story, I actually found the last section the easiest to follow. Putting myself into the shoes of a reader who wants to know, succinctly, 'how to do resource estimation', I recommend drawing inspiration from the last section, and using it to tell a cohesive story:

    • First section: show the reader how to do resource estimation with an existing, executable PL Kitaev model.

    • Second section:

      • introduce the compact Hamiltonian and briefly describe why it is useful, and show that its resource estimation matches the full one.
      • Show the reader how to rewrite their circuit using resource operators, and again compute the resources.
    • Third section: Change the default gateset, swap out one of the decompositions, and change the precision, and again compute the resources. I would probably avoid showing too many examples on single operators, as it is a bit distracting from the overall story.

    • Conclusion: the reader now knows how to do resource estimation in PL! Provide links to docs and other demos for more examples for them to read up on, or other configuration options that might be interesting.

    • Appendix

    • references



def gridsynth_decomp(precision):
t_resource_rep = qre.resource_rep(qre.T)
Copy link
Member

Choose a reason for hiding this comment

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

What is the resource_rep function? I think this is the first time a reader sees it

Comment on lines +509 to +511
t_gate_counts = qre.GateCount(
t_resource_rep, t_counts
) # GateCounts tell us how many of this type of gate are used
Copy link
Member

Choose a reason for hiding this comment

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

Because I don't understand what resource rep is, I don't quite understand this function either!

Comment on lines 522 to 524
grisynth_rc = qre.ResourceConfig()
grisynth_rc.set_decomp(qre.RZ, gridsynth_decomp)
grisynth_cost_RZ = qre.estimate(qre.RZ(precision=1e-9), config=grisynth_rc)
Copy link
Member

Choose a reason for hiding this comment

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

More of a broader question outside the scope of this demo, but how come the way you define decompositions in the QRE API is different from how you do it in the regular PL API?

As a user, I would definitely love for them to be much closer (if not identical!) in API, as that makes PL a much more intuitive experience for me.

Copy link
Contributor

Choose a reason for hiding this comment

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

@josh146 this is a great question!

Actually while we were developing this functionality the UI changed a few times. Initially we didn't even have a resource config object, we had a function qre.set_decmp(Op_type, new_decomp) which would override the base classes decomposition method.

The reason this doesn't currently sync up with PLs Alt and Fixed decomp structure is because at the time the graph based decomposition pipeline was also under development. There was no clear spec for what the UI should be.

I don't think there are any technical reasons for why were can't switch to a similar UI for setting the decomposition now to match PLs set decomposition.

@AntonNI8 AntonNI8 requested review from DSGuala and josh146 November 26, 2025 23:44
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