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

Add Hamiltonian expval in the forward path #333

Merged
merged 15 commits into from
Aug 23, 2022
Merged

Conversation

chaeyeunpark
Copy link
Contributor

@chaeyeunpark chaeyeunpark commented Aug 20, 2022

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
    tests 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 .github/CHANGELOG.md file, summarizing the
    change, and including a link back to the PR.

  • Ensure that code is properly formatted by running make format.

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


Context:

Description of the Change:
Observable class and its subclasses are now under simulator module and used for expval.

Benefits:

Possible Drawbacks:

Related GitHub Issues:

@github-actions
Copy link
Contributor

github-actions bot commented Aug 20, 2022

Test Report (Linux, Kokkos, and Kokkos Kernels) on Ubuntu

           1 files  ±0             1 suites  ±0   2s ⏱️ ±0s
       956 tests ±0         956 ✔️ ±0  0 💤 ±0  0 ±0 
234 969 runs  ±0  234 969 ✔️ ±0  0 💤 ±0  0 ±0 

Results for commit c7fbb05. ± Comparison against base commit c443592.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Contributor

Hello. You may have forgotten to update the changelog!
Please edit .github/CHANGELOG.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.

@chaeyeunpark chaeyeunpark mentioned this pull request Aug 22, 2022
5 tasks
@chaeyeunpark chaeyeunpark marked this pull request as ready for review August 22, 2022 20:22
@codecov
Copy link

codecov bot commented Aug 22, 2022

Codecov Report

Merging #333 (c7fbb05) into master (c443592) will decrease coverage by 0.09%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #333      +/-   ##
==========================================
- Coverage   99.84%   99.74%   -0.10%     
==========================================
  Files          73       73              
  Lines        5115     5119       +4     
==========================================
- Hits         5107     5106       -1     
- Misses          8       13       +5     
Impacted Files Coverage Δ
pennylane_lightning/src/simulator/Measures.hpp 100.00% <ø> (ø)
pennylane_lightning/src/simulator/Observables.hpp 100.00% <ø> (ø)
pennylane_lightning/_serialize.py 100.00% <100.00%> (ø)
pennylane_lightning/_version.py 100.00% <100.00%> (ø)
pennylane_lightning/lightning_qubit.py 99.63% <100.00%> (+<0.01%) ⬆️
pennylane_lightning/src/algorithms/AlgUtil.hpp 100.00% <100.00%> (ø)
...ennylane_lightning/src/algorithms/JacobianTape.hpp 100.00% <100.00%> (ø)
...ennylane_lightning/src/simulator/KernelMap_X64.cpp 88.88% <0.00%> (-11.12%) ⬇️
...nnylane_lightning/src/simulator/CPUMemoryModel.hpp 90.90% <0.00%> (-6.07%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@chaeyeunpark chaeyeunpark requested review from mlxd and AmintorDusko and removed request for mlxd August 22, 2022 20:51
Copy link
Member

@mlxd mlxd left a comment

Choose a reason for hiding this comment

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

Nice work @chaeyeunpark
Just a few small questions:

pennylane_lightning/_serialize.py Show resolved Hide resolved
pennylane_lightning/src/algorithms/JacobianTape.hpp Outdated Show resolved Hide resolved
pennylane_lightning/_serialize.py Show resolved Hide resolved
@chaeyeunpark
Copy link
Contributor Author

chaeyeunpark commented Aug 23, 2022

[sc-22260]

Copy link
Member

@mlxd mlxd left a comment

Choose a reason for hiding this comment

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

Thanks @chaeyeunpark
I approved, but left one comment for future updates.

Copy link
Contributor

@AmintorDusko AmintorDusko left a comment

Choose a reason for hiding this comment

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

Hi, @chaeyeunpark! Nice work, Thanks!

chaeyeunpark and others added 2 commits August 23, 2022 16:57
Co-authored-by: Lee James O'Riordan <mlxd@users.noreply.github.com>
@chaeyeunpark chaeyeunpark merged commit 9bad592 into master Aug 23, 2022
@chaeyeunpark chaeyeunpark deleted the add_expval_ham branch August 23, 2022 22:07
chaeyeunpark added a commit that referenced this pull request Sep 18, 2022
commit 84e31bd
Author: Christina Lee <chrissie.c.l@gmail.com>
Date:   Fri Sep 9 09:22:56 2022 -0700

    Defer op-arithmetic to default qubit (#349)

    * defer op-arithmetic to default qubit

    * Auto update version

    * tests, changelog, black

    * differentiation tests

    * black

    Co-authored-by: Dev version update bot <github-actions[bot]@users.noreply.github.com>

commit 3b78924
Author: Matthew Silverman <ma.silv11@gmail.com>
Date:   Tue Aug 30 08:48:53 2022 -0400

    remove `supports_reversible_diff` (#342)

    * remove unused option

    * Auto update version

    Co-authored-by: Dev version update bot <github-actions[bot]@users.noreply.github.com>

commit 6958fb8
Author: Amintor Dusko <87949283+AmintorDusko@users.noreply.github.com>
Date:   Mon Aug 29 09:36:08 2022 -0400

    Quick fix for upload artifact for win (#346)

    * fix upload artifact for win

    * update changelog

commit 66429b0
Author: Rashid N H M <95639609+rashidnhm@users.noreply.github.com>
Date:   Sat Aug 27 21:28:06 2022 -0400

    Updated ReadTheDocs bade to new url (#339)

    * Updated ReadTheDocs bade to new url

    * Auto update version

    * Auto update version

    Co-authored-by: Dev version update bot <chae-yeun@xanadu.ai>
    Co-authored-by: Josh Izaac <josh146@gmail.com>
    Co-authored-by: Dev version update bot <github-actions[bot]@users.noreply.github.com>

commit f1a6789
Author: Amintor Dusko <87949283+AmintorDusko@users.noreply.github.com>
Date:   Fri Aug 26 13:41:14 2022 -0400

    Update cancel-workflow-action and bot credentials (#345)

    * update bot credentials

    * update cancel-workflow-action

commit b594234
Author: Lee James O'Riordan <mlxd@users.noreply.github.com>
Date:   Fri Aug 26 09:21:15 2022 -0400

    Update tagger bot for latest release (#344)

    * Update tagged CI for releases

    * Auto update version

    * Update changelog [skip_ci]

    Co-authored-by: Dev version update bot <chae-yeun@xanadu.ai>

commit 8265edd
Author: Amintor Dusko <87949283+AmintorDusko@users.noreply.github.com>
Date:   Thu Aug 25 10:59:45 2022 -0400

    Caching Kokkos build for wheel-builds (#316)

    * introduce caching Kokkos for wheels

    * improve process_options file

    * isolate Kokkos installation

    * offload windows wheel build to cibuildwheel

    * update PennyLane-Lightning build

    Co-authored-by: Lee James O'Riordan <mlxd@users.noreply.github.com>
    Co-authored-by: Lee J. O'Riordan <lee@xanadu.ai>

commit 2282f9f
Author: Chae-Yeun Park <chae-yeun@xanadu.ai>
Date:   Wed Aug 24 10:07:59 2022 -0400

    Exclude AVX512 lines from codecov (#340)

    * Add expval(ham) forward

    * Fix namespace

    * Auto update version

    * Trigger CI

    * Unwrap ArrayBox

    * Format

    * Trigger CI

    * Remove irrelevant file

    * Update for CodeCov

    * Auto update version

    * Retry for AVX2

    * Retry for AVX2

    * Retry for AVX2

    * Retry for AVX2

    * Retry for AVX2

commit 9bad592
Author: Chae-Yeun Park <chae-yeun@xanadu.ai>
Date:   Tue Aug 23 18:07:46 2022 -0400

    Add Hamiltonian expval in the forward path (#333)

    * Add expval(ham) forward

    * Fix namespace

    * Auto update version

    * Trigger CI

    * Unwrap ArrayBox

    * Format

    * Trigger CI

    * Auto update version

    * Remove irrelevant file

    * Auto update version

    * Update pennylane_lightning/src/algorithms/JacobianTape.hpp

    Co-authored-by: Lee James O'Riordan <mlxd@users.noreply.github.com>

    * Update changelog

    Co-authored-by: Lee James O'Riordan <mlxd@users.noreply.github.com>

commit c443592
Author: Josh Izaac <josh146@gmail.com>
Date:   Tue Aug 23 11:11:50 2022 -0400

    Update docs URL (#335)

    * Update docs URL

    * Auto update version

    * Auto update version

    * update navbar

    Co-authored-by: Dev version update bot <chae-yeun@xanadu.ai>
    Co-authored-by: Amintor Dusko <87949283+AmintorDusko@users.noreply.github.com>

commit bc54a3e
Author: Josh Izaac <josh146@gmail.com>
Date:   Tue Aug 23 02:45:02 2022 +0800

    Update conf.py

commit 1e43ace
Author: Chae-Yeun Park <chae-yeun@xanadu.ai>
Date:   Mon Aug 22 14:37:00 2022 -0400

    Fix measurement error message (#334)

    * Fix measurement error message

    * Reformat

    * Add Changelog

commit c15fa0d
Author: Amintor Dusko <87949283+AmintorDusko@users.noreply.github.com>
Date:   Thu Aug 18 10:06:32 2022 -0400

    Create a PennyLane-lightning requirements-dev.txt and update the Dockerfile (#330)

    * Create a requirements-dev.txt

    * Update tests and benchmarks

    * Improve dockerfile

commit 87538ec
Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Date:   Mon Aug 15 10:57:49 2022 -0400

    post release version bump (#331)

    Co-authored-by: mlxd <mlxd@users.noreply.github.com>

commit dc0d3b1
Author: Lee J. O'Riordan <loriordan@gmail.com>
Date:   Thu Aug 11 13:03:58 2022 -0400

    Remove redundant Win ops and pin to WS2019

commit e5755d9
Author: Lee J. O'Riordan <loriordan@gmail.com>
Date:   Thu Aug 11 11:39:24 2022 -0400

    Remove build base command

commit ba16ec9
Author: Lee J. O'Riordan <loriordan@gmail.com>
Date:   Thu Aug 11 11:32:27 2022 -0400

    Downgrade Py3.10 version to avoid additional characters in build path

commit e3f8b4e
Author: Lee J. O'Riordan <loriordan@gmail.com>
Date:   Thu Aug 11 11:19:56 2022 -0400

    Attempt updating Python installation package for Windows runner

commit 90c06cc
Author: Lee J. O'Riordan <loriordan@gmail.com>
Date:   Thu Aug 11 11:00:55 2022 -0400

    Retry forcing longpaths for W10 build

commit 36abd9b
Author: Lee J. O'Riordan <loriordan@gmail.com>
Date:   Thu Aug 11 10:38:24 2022 -0400

    Disable clone of Kokkos submodules to allow Windows builds to proceed

commit becd10c
Author: Lee J. O'Riordan <loriordan@gmail.com>
Date:   Thu Aug 11 08:45:43 2022 -0400

    Fix changelog++

commit c321d34
Author: Lee J. O'Riordan <loriordan@gmail.com>
Date:   Thu Aug 11 08:44:12 2022 -0400

    Fix changelog

commit c198a5d
Author: Lee J. O'Riordan <loriordan@gmail.com>
Date:   Tue Aug 9 12:10:44 2022 -0400

    Update version string

    Signed-off-by: Lee J. O'Riordan <loriordan@gmail.com>

commit 2dd4b80
Author: Lee J. O'Riordan <loriordan@gmail.com>
Date:   Tue Aug 9 12:08:50 2022 -0400

    Update changelog
chaeyeunpark added a commit that referenced this pull request Feb 7, 2023
* Adding more Generators

* Adding more AVX generators/gates

* Adding Generators

* Update

* AddIsingXY

* Add ControlledPhaseShift

* Squashed commit of the following:

commit 84e31bd
Author: Christina Lee <chrissie.c.l@gmail.com>
Date:   Fri Sep 9 09:22:56 2022 -0700

    Defer op-arithmetic to default qubit (#349)

    * defer op-arithmetic to default qubit

    * Auto update version

    * tests, changelog, black

    * differentiation tests

    * black

    Co-authored-by: Dev version update bot <github-actions[bot]@users.noreply.github.com>

commit 3b78924
Author: Matthew Silverman <ma.silv11@gmail.com>
Date:   Tue Aug 30 08:48:53 2022 -0400

    remove `supports_reversible_diff` (#342)

    * remove unused option

    * Auto update version

    Co-authored-by: Dev version update bot <github-actions[bot]@users.noreply.github.com>

commit 6958fb8
Author: Amintor Dusko <87949283+AmintorDusko@users.noreply.github.com>
Date:   Mon Aug 29 09:36:08 2022 -0400

    Quick fix for upload artifact for win (#346)

    * fix upload artifact for win

    * update changelog

commit 66429b0
Author: Rashid N H M <95639609+rashidnhm@users.noreply.github.com>
Date:   Sat Aug 27 21:28:06 2022 -0400

    Updated ReadTheDocs bade to new url (#339)

    * Updated ReadTheDocs bade to new url

    * Auto update version

    * Auto update version

    Co-authored-by: Dev version update bot <chae-yeun@xanadu.ai>
    Co-authored-by: Josh Izaac <josh146@gmail.com>
    Co-authored-by: Dev version update bot <github-actions[bot]@users.noreply.github.com>

commit f1a6789
Author: Amintor Dusko <87949283+AmintorDusko@users.noreply.github.com>
Date:   Fri Aug 26 13:41:14 2022 -0400

    Update cancel-workflow-action and bot credentials (#345)

    * update bot credentials

    * update cancel-workflow-action

commit b594234
Author: Lee James O'Riordan <mlxd@users.noreply.github.com>
Date:   Fri Aug 26 09:21:15 2022 -0400

    Update tagger bot for latest release (#344)

    * Update tagged CI for releases

    * Auto update version

    * Update changelog [skip_ci]

    Co-authored-by: Dev version update bot <chae-yeun@xanadu.ai>

commit 8265edd
Author: Amintor Dusko <87949283+AmintorDusko@users.noreply.github.com>
Date:   Thu Aug 25 10:59:45 2022 -0400

    Caching Kokkos build for wheel-builds (#316)

    * introduce caching Kokkos for wheels

    * improve process_options file

    * isolate Kokkos installation

    * offload windows wheel build to cibuildwheel

    * update PennyLane-Lightning build

    Co-authored-by: Lee James O'Riordan <mlxd@users.noreply.github.com>
    Co-authored-by: Lee J. O'Riordan <lee@xanadu.ai>

commit 2282f9f
Author: Chae-Yeun Park <chae-yeun@xanadu.ai>
Date:   Wed Aug 24 10:07:59 2022 -0400

    Exclude AVX512 lines from codecov (#340)

    * Add expval(ham) forward

    * Fix namespace

    * Auto update version

    * Trigger CI

    * Unwrap ArrayBox

    * Format

    * Trigger CI

    * Remove irrelevant file

    * Update for CodeCov

    * Auto update version

    * Retry for AVX2

    * Retry for AVX2

    * Retry for AVX2

    * Retry for AVX2

    * Retry for AVX2

commit 9bad592
Author: Chae-Yeun Park <chae-yeun@xanadu.ai>
Date:   Tue Aug 23 18:07:46 2022 -0400

    Add Hamiltonian expval in the forward path (#333)

    * Add expval(ham) forward

    * Fix namespace

    * Auto update version

    * Trigger CI

    * Unwrap ArrayBox

    * Format

    * Trigger CI

    * Auto update version

    * Remove irrelevant file

    * Auto update version

    * Update pennylane_lightning/src/algorithms/JacobianTape.hpp

    Co-authored-by: Lee James O'Riordan <mlxd@users.noreply.github.com>

    * Update changelog

    Co-authored-by: Lee James O'Riordan <mlxd@users.noreply.github.com>

commit c443592
Author: Josh Izaac <josh146@gmail.com>
Date:   Tue Aug 23 11:11:50 2022 -0400

    Update docs URL (#335)

    * Update docs URL

    * Auto update version

    * Auto update version

    * update navbar

    Co-authored-by: Dev version update bot <chae-yeun@xanadu.ai>
    Co-authored-by: Amintor Dusko <87949283+AmintorDusko@users.noreply.github.com>

commit bc54a3e
Author: Josh Izaac <josh146@gmail.com>
Date:   Tue Aug 23 02:45:02 2022 +0800

    Update conf.py

commit 1e43ace
Author: Chae-Yeun Park <chae-yeun@xanadu.ai>
Date:   Mon Aug 22 14:37:00 2022 -0400

    Fix measurement error message (#334)

    * Fix measurement error message

    * Reformat

    * Add Changelog

commit c15fa0d
Author: Amintor Dusko <87949283+AmintorDusko@users.noreply.github.com>
Date:   Thu Aug 18 10:06:32 2022 -0400

    Create a PennyLane-lightning requirements-dev.txt and update the Dockerfile (#330)

    * Create a requirements-dev.txt

    * Update tests and benchmarks

    * Improve dockerfile

commit 87538ec
Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Date:   Mon Aug 15 10:57:49 2022 -0400

    post release version bump (#331)

    Co-authored-by: mlxd <mlxd@users.noreply.github.com>

commit dc0d3b1
Author: Lee J. O'Riordan <loriordan@gmail.com>
Date:   Thu Aug 11 13:03:58 2022 -0400

    Remove redundant Win ops and pin to WS2019

commit e5755d9
Author: Lee J. O'Riordan <loriordan@gmail.com>
Date:   Thu Aug 11 11:39:24 2022 -0400

    Remove build base command

commit ba16ec9
Author: Lee J. O'Riordan <loriordan@gmail.com>
Date:   Thu Aug 11 11:32:27 2022 -0400

    Downgrade Py3.10 version to avoid additional characters in build path

commit e3f8b4e
Author: Lee J. O'Riordan <loriordan@gmail.com>
Date:   Thu Aug 11 11:19:56 2022 -0400

    Attempt updating Python installation package for Windows runner

commit 90c06cc
Author: Lee J. O'Riordan <loriordan@gmail.com>
Date:   Thu Aug 11 11:00:55 2022 -0400

    Retry forcing longpaths for W10 build

commit 36abd9b
Author: Lee J. O'Riordan <loriordan@gmail.com>
Date:   Thu Aug 11 10:38:24 2022 -0400

    Disable clone of Kokkos submodules to allow Windows builds to proceed

commit becd10c
Author: Lee J. O'Riordan <loriordan@gmail.com>
Date:   Thu Aug 11 08:45:43 2022 -0400

    Fix changelog++

commit c321d34
Author: Lee J. O'Riordan <loriordan@gmail.com>
Date:   Thu Aug 11 08:44:12 2022 -0400

    Fix changelog

commit c198a5d
Author: Lee J. O'Riordan <loriordan@gmail.com>
Date:   Tue Aug 9 12:10:44 2022 -0400

    Update version string

    Signed-off-by: Lee J. O'Riordan <loriordan@gmail.com>

commit 2dd4b80
Author: Lee J. O'Riordan <loriordan@gmail.com>
Date:   Tue Aug 9 12:08:50 2022 -0400

    Update changelog

* Refactor some AVX functions; Add CRY

* Update

* Add AVX CRZ; format

* Auto update version

* Fix for Tidy

* Add CRX

* Format

* Fix for tidy

* Auto update version

* Add some comments

* Update

* Apply suggestions from code review

Co-authored-by: Amintor Dusko <87949283+AmintorDusko@users.noreply.github.com>

* Adding more comments

* Update comment; Add readme

* Update README

* Update

* Update

* change to PL_ASSERT

* Fix SWAP

* Tidying-up some headers

* Add docstrings to helper functions

* Change some constexpr functions to consteval

* Update setValue

* Apply suggestions from code review

Co-authored-by: Lee James O'Riordan <mlxd@users.noreply.github.com>

* Remove unneccesary head

* Retry CI

* Apply suggestions from code review

Co-authored-by: Amintor Dusko <87949283+AmintorDusko@users.noreply.github.com>

* Auto update version

* Update formatting

* Auto update version

* Add some more explanation

* Update changelog

* Format

* Update .github/CHANGELOG.md

Co-authored-by: Amintor Dusko <87949283+AmintorDusko@users.noreply.github.com>

---------

Co-authored-by: Dev version update bot <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Amintor Dusko <87949283+AmintorDusko@users.noreply.github.com>
Co-authored-by: Lee James O'Riordan <mlxd@users.noreply.github.com>
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