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.38k stars 607 forks source link

Add simulate of analytic case for DefaultMixedNewAPI #6618

Open JerryChen97 opened 1 week ago

JerryChen97 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 implementation of method simulate is the most important one under the architecture of new API standard. The point of simulate, is basically abstract both the analytic version (controlled by shots=None, or infinite shots in a fancier way) and the MC version (finite shots). Meanwhile, the functionality of such method should not truly depend on our details of qml implementationi; they better only rely on either the fundamental computation libs, e.g. math lib and qnp, or the most essential infras, e.g. Tape/Scripts and Operations.

Description of the Change:

Benefits:

Possible Drawbacks:

Related GitHub Issues: [sc-73320]

JerryChen97 commented 1 day ago

The three fails up to now are all expected; will fix when the blockers were removed and this branch got updated

JerryChen97 commented 1 day ago

@lillian542 I just rebased to the measure branch. There might be still some confusing out-of-scope changes somehwere e.g. a little fix regarding init_state over the other PR; but this PR's primary purpose is to introduce the added file simulate.py as well as its test suite

codecov[bot] commented 21 hours ago

Codecov Report

Attention: Patch coverage is 95.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 99.64%. Comparing base (ff09567) to head (c266b34). Report is 5 commits behind head on add-qubit_mixed/measure.

Files with missing lines Patch % Lines
pennylane/devices/default_mixed.py 66.66% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## add-qubit_mixed/measure #6618 +/- ## =========================================================== - Coverage 99.65% 99.64% -0.01% =========================================================== Files 456 457 +1 Lines 43019 43055 +36 =========================================================== + Hits 42870 42904 +34 - Misses 149 151 +2 ```

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