Skip to content

Fix: Ensure QubitOperator is simplified before sparse conversion#1128

Draft
Aniketsy wants to merge 8 commits intoquantumlib:mainfrom
Aniketsy:fix-sparse-operator-simplify
Draft

Fix: Ensure QubitOperator is simplified before sparse conversion#1128
Aniketsy wants to merge 8 commits intoquantumlib:mainfrom
Aniketsy:fix-sparse-operator-simplify

Conversation

@Aniketsy
Copy link
Copy Markdown

#880
This PR fixes an issue where get_sparse_operator fails when given a non-simplified QubitOperator

Please let me know if my approach or fix needs any improvements . I’m open to feedback and happy to make changes based on suggestions.
Thankyou !

@mhucka mhucka added area/functionality Involves the features and operations implemented in OpenFermion area/health Involves code and/or project health labels Sep 25, 2025
@mhucka
Copy link
Copy Markdown
Contributor

mhucka commented Oct 13, 2025

Thanks for this contribution. This is currently failing CI tests because the function simplify() does not seem to exist on the object. Could you please investigate?

Also, I highly recommend running tests locally before submitting a PR, to catch problems like this.

@Aniketsy
Copy link
Copy Markdown
Author

Sure, Thanks! I will look into it .

@Aniketsy Aniketsy force-pushed the fix-sparse-operator-simplify branch from 52f8f8e to 298399c Compare October 13, 2025 06:59
@mhucka mhucka self-assigned this Mar 13, 2026
@mhucka mhucka force-pushed the fix-sparse-operator-simplify branch from 8f7c39c to 55e40b8 Compare March 31, 2026 03:50
@mhucka
Copy link
Copy Markdown
Contributor

mhucka commented Mar 31, 2026

@Aniketsy Thanks for this contribution. I took the liberty of merging the latest changes from the main branch and pushing a small change to your fork, in an attempt to resolve some remaining errors and warnings. However, it turns out that the warnings about simplification now show up all over the place in the tests. This is surely an indication that the change to get_sparse_operator() is not the right way to solve the underlying problem. Unfortunately, I also lack the domain expertise to figure out the correct solution.

@Aniketsy
Copy link
Copy Markdown
Author

@mhucka thanks for pushing the changes, and I apologize for keeping this PR stale for log time, as i was envolved in other things but I will take a look in this again and i'll try to fix this! :)

@mhucka mhucka marked this pull request as draft March 31, 2026 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/functionality Involves the features and operations implemented in OpenFermion area/health Involves code and/or project health

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants