PennyLaneAI / catalyst

A JIT compiler for hybrid quantum programs in PennyLane
https://docs.pennylane.ai/projects/catalyst
Apache License 2.0
109 stars 28 forks source link

[Frontend] Split non-commuting observables #821

Closed lillian542 closed 4 weeks ago

lillian542 commented 1 month ago

Context: State-based simulators can generally get the values for non-commuting observables together on a single execution. Hardware and some simulators require non-commuting observables to be separated into different executions.

Description of the Change: We add a non_commuting_observables flag to the TOML file. If True, the device can deal with non-commuting observables.

We check the non_commuting_observables_flag in device.preprocess, and add the split_non_commuting transform to the transform_program if it's False.

lillian542 commented 1 month ago

[sc-60186]

github-actions[bot] commented 1 month ago

Hello. You may have forgotten to update the changelog! Please edit doc/changelog.md on your branch with:

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 97.96%. Comparing base (5612227) to head (3a7aa23).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #821 +/- ## ======================================= Coverage 97.95% 97.96% ======================================= Files 71 71 Lines 10244 10248 +4 Branches 902 903 +1 ======================================= + Hits 10035 10039 +4 Misses 167 167 Partials 42 42 ```

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

lillian542 commented 4 weeks ago

Edit: wrong story ID [sc-60187]

lillian542 commented 4 weeks ago

[sc-60188]

dime10 commented 4 weeks ago

Did we add the flag to lightning as well? :)

lillian542 commented 4 weeks ago

Did we add the flag to lightning as well? :)

Yes!