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

[new opmath 3] Make qml.Hamiltonian alias for qml.LinearCombination with new op math using __getattr__ #5393

Merged
merged 49 commits into from
Mar 20, 2024

Conversation

mudit2812
Copy link
Contributor

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:

Description of the Change:

Benefits:

Possible Drawbacks:

Related GitHub Issues:

@mudit2812 mudit2812 changed the base branch from linearcombination to ham-tests March 18, 2024 18:33
tests/test_operation.py Outdated Show resolved Hide resolved
@Qottmann Qottmann marked this pull request as ready for review March 19, 2024 09:24
Copy link

codecov bot commented Mar 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.47%. Comparing base (a7eee13) to head (afc163d).

Additional details and impacted files
@@              Coverage Diff              @@
##           ham-tests    #5393      +/-   ##
=============================================
- Coverage      99.47%   99.47%   -0.01%     
=============================================
  Files            400      400              
  Lines          37136    37133       -3     
=============================================
- Hits           36940    36937       -3     
  Misses           196      196              

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

Qottmann and others added 24 commits March 20, 2024 10:29
Co-authored-by: Astral Cai <astral.cai@xanadu.ai>
Co-authored-by: Mudit Pandey <mudit.pandey@xanadu.ai>
Co-authored-by: Astral Cai <astral.cai@xanadu.ai>
Co-authored-by: Mudit Pandey <mudit.pandey@xanadu.ai>
**Context:** A couple of tests failed with the new `stim` release.

**Description of the Change:** Force `int` conversion from `numpy.int64`
type and increase the number of shots to improve the robustness of
sampling tests.

**Benefits:**

**Possible Drawbacks:** N/A

**Related GitHub Issues:** N/A
### Before submitting

Please complete the following checklist when submitting a PR:

- [x] 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!

- [x] 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`.

- [x] Ensure that the test suite passes, by running `make test`.

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

- [x] The PennyLane source code conforms to
      [PEP8 standards](https://www.python.org/dev/peps/pep-0008/).
We check all of our code against [Pylint](https://www.pylint.org/).
      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:**
The Lightning simulators derive from `QubitDevice`. With the recent
addition of `MidMeasureMP` support in `lightning.qubit`, we can
potentially enable dynamic circuit execution in the Lightning family.

**Description of the Change:**
If the tape has mid-circuit measurements before apply, pass a
`mid_measurements` dictionary through `apply` via `kwargs`. Finally
return `mid_measurements` along with the results if operating in dynamic
mode. Also add `dynamic_one_shot` to the `full_transform_program` if
MCMs are present in the tape and the device has capability
`supports_mid_measure`.

**Benefits:**

**Possible Drawbacks:**

**Related GitHub Issues:**

---------

Co-authored-by: Josh Izaac <josh146@gmail.com>
Co-authored-by: Nathan Killoran <co9olguy@users.noreply.github.com>
Co-authored-by: Matthew Silverman <matthews@xanadu.ai>
Co-authored-by: Astral Cai <astral.cai@xanadu.ai>
Co-authored-by: Mikhail Andrenkov <mikhail@xanadu.ai>
Automatic update of stable requirement files to snapshot valid python
environments.

Because bots are not able to trigger CI on their own, please do so by
pushing an empty commit to this branch using the following command:

```
git commit --allow-empty -m 'trigger ci'
```

Alternatively, wait for this branch to be out-of-date with master, then
just use the "Update branch" button!

Note that it is expected that the PennyLane-Lightning repo is a version
ahead of the release, because the
version number is taken from the dev branch. Trying to `pip install`
from the files will fail until that
major version of Lightning is released.

If pip install fails with a not found error when installing because of
this, it can be fixed by manually
downgrading the PennyLane-Lightning version number in the file by 1
version and trying again.

---------

Co-authored-by: GitHub Actions Bot <>
Co-authored-by: Alex Preciado <alex.preciado@xanadu.ai>
Co-authored-by: Christina Lee <christina@xanadu.ai>
Co-authored-by: Mudit Pandey <mudit.pandey@xanadu.ai>
Co-authored-by: Astral Cai <astral.cai@xanadu.ai>
@mudit2812 mudit2812 requested a review from a team as a code owner March 20, 2024 14:38
@mudit2812 mudit2812 removed the request for review from a team March 20, 2024 14:50
@mudit2812 mudit2812 merged commit 84868d7 into ham-tests Mar 20, 2024
39 checks passed
@mudit2812 mudit2812 deleted the getattr-ham-lc-aliasing branch March 20, 2024 15:51
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.

8 participants