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
Accelerate Jordan-Wigner transform #4046
Conversation
Hello. You may have forgotten to update the changelog!
|
Codecov Report
@@ Coverage Diff @@
## master #4046 +/- ##
==========================================
- Coverage 99.73% 99.73% -0.01%
==========================================
Files 345 345
Lines 30787 30784 -3
==========================================
- Hits 30704 30701 -3
Misses 83 83
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @vincentmr for the improvement! Left a suggestion and also a timing comparison for computing molecular Hamiltonians (the molecules are H2, H3+, LiH, H2O
).
This is nice, thanks for the timing data. |
For the record, after the current changes, the biggest bottlenecks are |
Thanks @vincentmr. The |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @vincentmr, overall looks good! Does caching have any ill-effect on memory profiles for building larger observables? It might be nice to have some memory-benchmarks too.
Calling
There is no noticeable differences between the memory profiles for any wire count. They all look like (on my laptop) |
Co-authored-by: Utkarsh <utkarshazad98@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 thechange, 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 thenrun
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:
Jordan-Wigner transforms can take a while to compute. Most of the time is spent in
__init__
of the various Pauli gates.Description of the Change:
Cache Pauli gate objects.
Benefits:
Faster transforms (e.g. 160->38 sec. for generating the molecular Hamiltonian of an H2 molecule in the "cc-pvdz" basis).
Possible Drawbacks:
Deepcopy necessary?
Related GitHub Issues: