-
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
Bosonic operators #1085
Bosonic operators #1085
Conversation
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.
A few initial observations. We will also need to add a release note 👍
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.
Overall I think this PR is already in pretty good shape. I left quite a few comments, some of which
are nitpicks, others are a bit more broad. In general, I'd like to add these notes:
- we need to add a release note (see here)
- you need to run the code formatter:
make black
(from the repo root) - you need to add
bosonicop
as a spell exception to.pylintdict
- the docstrings are mostly not formatted properly. This can be quite tricky when just getting
started so I suggest this in our offline-scheduled meeting. I left some pointers in my
comments below already though.
ordered_op = self.normal_order() | ||
|
||
data = defaultdict(complex) # type: dict[str, _TCoeff] | ||
# TODO: use parallel_map to make this 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.
FYI for another reviewer: this TODO is copied over from FermionicOp
and out-of-scope for this PR
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.
Here are a few more comments in preparation for our meeting (no need to address them before).
Co-authored-by: Elena Peña Tapia <[email protected]> Co-authored-by: Max Rossmannek <[email protected]>
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 Francesco! Just a few more steps. We were looking for a specific way of defining properties and property setters, see specific comments in the code.
Co-authored-by: Elena Peña Tapia <[email protected]>
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.
Yay! The CI passes!! I took a look at the rendered docs and I think there are two last things that can be improved (getting picky here):
- The definitions of the sigma +/- operators should be in separate lines (idk why Sphinx is not getting the line break)
- I think that the two references would look better if they were in separate lines too.
I added two suggestions that will hopefully fix this :)
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 last last thing
Co-authored-by: Elena Peña Tapia <[email protected]>
Co-authored-by: Elena Peña Tapia <[email protected]>
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.
Co-authored-by: Elena Peña Tapia <[email protected]>
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.
Max will probably give a last round of review, but in terms of docs, I have nothing to say other than good job. Thanks a lot!
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.
Okay, some last final nitpicky comments.
Once these changes are applied I'm confident we can merge this PR 👍
Co-authored-by: Max Rossmannek <[email protected]>
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.
Assuming I did not mess up my prior suggestions, CI should pass on this...
Thanks a lot, Francesco, for your hard work on this great contribution to Qiskit Nature! 🎉
Thank you, Elena, for your support in reviewing and helping Francesco out on the home stretch of this PR.
* Created bosonic operator file. Some notes on the code * modified ordering functions using commutator instead of anti-commutator * Created simplify method * Created test class for bosonic operator * Moved normal_order and index_order before simplify. Fixed the expected results * Fixed tests. Hermicity test is still missing * Improved algorithm for simplify. Now calls normal order as first operation. Fixed tests * fixed is_hermitian method * Addressed PR comments * Pipelines fixes * Created bosonic_linear_mapper class * Added some unit tests for bosonic linear mapper. Pipelines fixes * Removed trailing whitspace * Fixed test case +_0 -_0 with truncation 2 * Implemented test cases +_0 -_1 and -_1 +_0. Some CI fixes * Added test case +_0 +_0 * Some CI fixes * Apply suggestions from code review Co-authored-by: Elena Peña Tapia <[email protected]> Co-authored-by: Max Rossmannek <[email protected]> * Added test for commutator relation * Added terms to pylintdict * Updated some mapper tests * Addressed some PR comments. Fixed final tests * Addressed PR comments for docstrings * Further doc fixes * Further CI fixes * Added release note * Spell fix in release note * Added methods from_terms and _permute_terms * Addressed PR comments * ran make black * Added r in front of docstring * Added reference for bosonic op truncation * Addressed PR comments * Added mapper example in bosonicLinearMapper docString * Updated error message * Renamed truncation property. Defined its setter * Apply suggestions for max_occupation setter Co-authored-by: Elena Peña Tapia <[email protected]> * ran make black * Removed unused import * Doc fixes Co-authored-by: Elena Peña Tapia <[email protected]> * Doc fix Co-authored-by: Elena Peña Tapia <[email protected]> * ran make black * Doc fix Co-authored-by: Elena Peña Tapia <[email protected]> * ran make black * Apply suggestions from code review Co-authored-by: Max Rossmannek <[email protected]> * Minor doc fix * Apply suggestions from code review * Update qiskit_nature/second_q/mappers/bosonic_mapper.py --------- Co-authored-by: Elena Peña Tapia <[email protected]> Co-authored-by: Max Rossmannek <[email protected]>
Summary
Details and comments