-
Notifications
You must be signed in to change notification settings - Fork 209
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
Improvement to the qiskit_nature.second_q.mappers
module
#1289
Comments
Re: ModeBasedMapper What would you do with the Re: pauli_table So I need to do something similar for the |
Yes, they would subclass both 👍
Yes, an instancemethod would be preferable. In case we want to parallelize these methods, we will need to be careful when using |
I would offer to implement the first two things. I finished the Ternary Tree Mapper and wanted to start a PR for that today-ish, but I could include these changes and the new mapper into a single PR if that would be okay? Regarding the caching:
|
If you want to work on this, please go ahead, by all means! I suggest to keep these in separate PRs, just to keep reviewing simpler. Especially, because some of these changes may need to propagate through all classes. Just keep in mind, that reviewing might slow down for the rest of year because many of us will be on vacation over the upcoming holidays.
Yes, I think that is a good call. I think, as things are now, the caching actually added little value.
How about you do a first PR which does only API cleanup:
If you can, doing some small performance tests for before and after would be amazing. See for example the following old issues which discussed performance: |
On a side note: I noticed that the base classes Apart from that, will do as suggested (maybe this weekend). |
This was a conscious decision as part of #1044.
Awesome! I will likely only be able to review your PR in the new year (just to make you aware). |
I see. I won't touch that then.
No problem at all. Given that Christmas approaches - as every year - surprisingly fast, chances are that I won't even open a PR before then ;). |
What should we add?
A few things in the
mappers
module could be improved. I will try to summarize some thoughts below based on gathered observations. (See also this thread: #1270 (comment).)the
QubitMapper.mode_based_mapping
method should really not be part of the base class. Instead, we could implement this as aModeBasedMapper
class which only the mappers that actually follow this implementation derive from (i.e.JordanWignerMapper
,ParityMapper
,BravyiKitaevMapper
, andDirectMapper
). This would avoid all other mappers to have this public method without it actually working (since they don't implement thepauli_table
classmethod.we should revert the use of
classmethod
for thepauli_table
in those mappers above, because this broke the initial implementation of the Bonsai mapper which was done externally. We should see if we can still keep the caching that was added in Change mode_based_mapping to instance method #699 as part of this change, to avoid a performance regression (Improve performance ofQubitMapper.mode_based_mapping
#644).I think the above two tasks could be combined into a single PR quite nicely.
QubitMapper
routines #771 I am simply referring to it here for completeness.The text was updated successfully, but these errors were encountered: