PennyLaneAI / pennylane

PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Train a quantum computer the same way as a neural network.
https://pennylane.ai
Apache License 2.0
2.17k stars 568 forks source link

Implement tree-traversal using an iterative approach #5868

Open vincentmr opened 1 week ago

vincentmr commented 1 week ago

Before submitting

Please complete the following checklist when submitting a PR:

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


Context: The tree-traversal algorithm was first implemented using a recursive approach for simplicity, but this potentially requires very deep stack calls for circuits with a lot of MCMs.

Description of the Change: Implement tree-traversal using an iterative approach. Do basic profiling and optimization.

Benefits: Remove system call increasing the default recursion call limit.

Possible Drawbacks:

Related GitHub Issues: [sc-65241]

codecov[bot] commented 1 week ago

Codecov Report

Attention: Patch coverage is 99.34641% with 1 line in your changes missing coverage. Please review.

Project coverage is 99.66%. Comparing base (f430d18) to head (928783f). Report is 1 commits behind head on master.

Files Patch % Lines
pennylane/devices/qubit/simulate.py 99.31% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #5868 +/- ## ========================================== - Coverage 99.66% 99.66% -0.01% ========================================== Files 425 425 Lines 40772 40559 -213 ========================================== - Hits 40636 40422 -214 - Misses 136 137 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.