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
Dispatch to old Jordan-Wigner function from new one #4253
Conversation
Hello. You may have forgotten to update the changelog!
|
Codecov Report
@@ Coverage Diff @@
## master #4253 +/- ##
=======================================
Coverage 99.78% 99.78%
=======================================
Files 352 352
Lines 31754 31759 +5
=======================================
+ Hits 31686 31692 +6
+ Misses 68 67 -1
|
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.
One is the top-level function, one is FermiWord, one is FermiSentence, one is the old function |
|
The current docstrings are fine. The old |
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 @lillian542, looks good. Any idea why codecov complains about #L210?
Thanks! But why do we have two different signatures for the first 3 options? Also, why do we need |
I'll update them to all take We need the |
Working with ps directly and not converting to operation makes some of the tapering functions more efficient. |
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 @lillian542, performed some local tests, all seems good.
This issue can be fixed by single dispatching over a private function and wrapping it with the main function:
|
Spoke with @soranjh offline, we concluded that this can be left as is in this PR and then separately addressed in the documentation PR. |
* pylint errors * update changelog * tidy up * hopefully fix formatting complaints * hopefully fix formatting complaints * Update doc/releases/changelog-dev.md * formatting and codecov * leave original jordan_wigner docstring in place so qchem documentation is unchanged * Update pennylane/fermi/conversion.py * fix docstring issue with dispatch * Revert "fix docstring issue with dispatch" This reverts commit 9f3e736.
Context:
There are now two functions called
jordan_wigner
in PennyLane. The existingjordan_wigner
function is available asqml.qchem.jordan_wigner
but not imported at top level. The new one lives inqml.fermi.jordan_wigner
. We want to only have one, imported at top level, but we don't want to break anything for people using the current one in the next PL release, as there is no time for a deprecation cycle.Additionally, we don't have time to update the many functions that use
jordan_wigner
to follow the new standard for before the release, so we can't add a deprecation warning yet; this would cause other unrelated functions to raise deprecation warnings through no fault of the user.Description of the Change:
The new
jordan_wigner
function uses single dispatch to call one of 3 functions, depending on whether thefermi_operator
passed to it is aFermiWord
,FermiSentence
orlist
(the legacy version). The newjordan_wigner
function thus encompasses all behaviour of the old one (renamed_jordan_wigner_legacy
).The imports have been updated so that the new
jordan_wigner
function can be imported asqml.jordan_wigner
,qml.fermi.jordan_wigner
, andqml.qchem.jordan_wigner
.