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

compute_plxpr_decomposition for StronglyEntanglingLayers, Grover, QFT #6917

Open
wants to merge 28 commits into
base: multi_level_decomp
Choose a base branch
from

Conversation

josephleekl
Copy link

@josephleekl josephleekl commented Feb 3, 2025

Before submitting

Please complete the following checklist when submitting a PR:

  • All new features must include a unit test.
    If you've fixed a bug or added code that should be tested, add a test to the
    test directory!

  • All new functions and code must be clearly commented and documented.
    If you do make documentation changes, make sure that the docs build and
    render correctly by running make docs.

  • Ensure that the test suite passes, by running make test.

  • Add a new entry to the doc/releases/changelog-dev.md file, summarizing the
    change, and including a link back to the PR.

  • The PennyLane source code conforms to
    PEP8 standards.
    We check all of our code against Pylint.
    To lint modified files, simply pip install pylint, and then
    run pylint pennylane/path/to/file.py.

When all the above are checked, delete everything above the dashed
line and fill in the pull request template.


Context:
This PR adds the implementation of compute_plxpr_decomposition to following operators:

  • StronglyEntanglingLayers
  • Grover
  • QFT

This PR extends the work here, which adds support to capturing control-flow in decomposition, including nested decomposition.

Description of the Change:

Benefits:

Possible Drawbacks:

Related GitHub Issues:

[sc-81818]

Copy link
Contributor

github-actions bot commented Feb 3, 2025

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.

Base automatically changed from cond_dynamic_decomp to master February 10, 2025 21:00
@josephleekl josephleekl changed the base branch from master to multi_level_decomp February 12, 2025 16:22
@josephleekl josephleekl removed the WIP 🚧 Work-in-progress label Feb 19, 2025
@josephleekl josephleekl marked this pull request as ready for review February 19, 2025 20:22
Copy link

codecov bot commented Feb 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.59%. Comparing base (a5a47f3) to head (1de3430).
Report is 17 commits behind head on multi_level_decomp.

Additional details and impacted files
@@                 Coverage Diff                  @@
##           multi_level_decomp    #6917    +/-   ##
====================================================
  Coverage               99.59%   99.59%            
====================================================
  Files                     481      482     +1     
  Lines                   45870    46145   +275     
====================================================
+ Hits                    45685    45960   +275     
  Misses                    185      185            

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

Copy link
Contributor

@PietropaoloFrisoni PietropaoloFrisoni left a comment

Choose a reason for hiding this comment

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

Thanks @josephleekl ! LGTM

I have a few other comments/questions but we can chat in person 🚀

@josephleekl josephleekl changed the title Dynamic decomposition with ctrl flow operators implementation compute_plxpr_decomposition for StronglyEntanglingLayers, Grover, QFT Feb 21, 2025
@partial(qml.transforms.decompose, max_expansion=max_expansion, gate_set=gate_set)
@qml.qnode(device=qml.device("default.qubit", wires=n_wires), autograph=False)
def circuit_comparison():
qml.StronglyEntanglingLayers(weights, wires=range(n_wires), imprimitive=imprimitive)
Copy link
Contributor

Choose a reason for hiding this comment

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

As discussed on Slack, we could also test the explicit structure of the jaxpr to ensure that the logic for max_expansion and gate_set is correct 🚀

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.

3 participants