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

docs: improve the documentation of SparseLabelOp.simplify #1261

Merged

Conversation

mrossinek
Copy link
Member

Summary

Closes #1260

Details and comments

@coveralls
Copy link

coveralls commented Sep 27, 2023

Pull Request Test Coverage Report for Build 6336900218

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.01%) to 86.74%

Totals Coverage Status
Change from base Build 6323000347: 0.01%
Covered Lines: 8707
Relevant Lines: 10038

💛 - Coveralls

@woodsp-ibm
Copy link
Member

In FermionicOp there is a note in index_order method that pertains to simplify. Would it be better in conjunction with this to more have a note in simplify so if you look at the subclass simplify docs you have an idea of the other methods that can be called first to potentially allow simplify to further reduce things. At present, both it and VibrationalOp inherit the SparseLabelOp simplify docstring that was updated here - so it would mean adding something for them - which BosonicOp already seems to do as it has further details there pertinent to that sub-class.

@mrossinek
Copy link
Member Author

I tried to find a solution which does not require duplicating the simplify docstring into the subclasses in order to append to it.
If you feel this solution is not sufficient, we can do that though.

@woodsp-ibm
Copy link
Member

I certainly would not suggest duplicating the entire thing - of course the args bit one has too and a sentence describing it. This is pretty much what BosonicOp.simplify() has plus some extra specific notes for that operator - it does not inherit the parent class docstring unlike FermionicOp or VibrationalOp. It is a bit extra work to do this for simplify but it could save the user going around other methods in the class to see if they would help - like index_order for example may do. I'll leave it to you - I'll approve this since in improves what it states - anything further like I was suggesting can always be done later since its "just docs".

woodsp-ibm
woodsp-ibm previously approved these changes Sep 27, 2023
@mrossinek
Copy link
Member Author

I actually had overlooked that BosonicOp.simplify already has a custom docstring. I will take another look on how to improve things 👍

@mrossinek
Copy link
Member Author

Okay, I did end up duplicating them but this allows a proper linking to the index_order method.
I did consider adding index_order as an abstractmethod to SparseLabelOp (because it is implemented by all of its subclasses anyways) but I was not confident that we really want to enforce this.

Since this is "just docs" lets leave it as a PR that really affects "just docs".

I also took the note regarding the difference between simplify and chop which we had in the BosonicOp docstring and made sure we have this everywhere.

@mrossinek mrossinek requested a review from ftroisi September 28, 2023 09:12
Copy link
Collaborator

@ftroisi ftroisi left a comment

Choose a reason for hiding this comment

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

Looks fine to me! Thanks for updating these docs

@ftroisi ftroisi merged commit 9bd7556 into qiskit-community:main Sep 28, 2023
@mrossinek mrossinek deleted the update-sparselabelop-simplify-docs branch September 28, 2023 13:05
ialsina pushed a commit to ialsina/qiskit-nature that referenced this pull request Nov 17, 2023
…munity#1261)

* docs: improve the documentation of SparseLabelOp.simplify

Closes qiskit-community#1260

* docs: unify the `simplify` docstrings

* docs: be even more explicit about term equivalence
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.

FermionicOp.simplify does not document its cross-behavior with FermionicOp.index_order
4 participants