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

fix: make FermionicOp.simplify preserve the term order #893

Merged

Conversation

mrossinek
Copy link
Member

Summary

Closes #888

Details and comments

@coveralls
Copy link

Pull Request Test Coverage Report for Build 3263501670

  • 9 of 9 (100.0%) changed or added relevant lines in 1 file are covered.
  • 3 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.02%) to 85.677%

Files with Coverage Reduction New Missed Lines %
qiskit_nature/second_q/operators/fermionic_op.py 3 93.42%
Totals Coverage Status
Change from base Build 3260274205: -0.02%
Covered Lines: 17048
Relevant Lines: 19898

💛 - Coveralls

@mrossinek mrossinek merged commit c7cfb85 into qiskit-community:main Oct 17, 2022
@mrossinek mrossinek deleted the simplify-preserving-order branch October 17, 2022 16:34
@@ -84,7 +84,7 @@ def test_compose(self):
) @ FermionicOp({"": 1, "-_0 +_1": 1}, num_spin_orbitals=2)
fer_op = fer_op.simplify()
targ = FermionicOp(
{"+_0 +_1 -_1": 1, "-_0 +_0 -_1": 1, "+_0 -_0 +_1": 1, "-_0 -_1 +_1": -1},
{"+_0 +_1 -_1": 1, "-_0 +_0 -_1": 1, "+_0 +_1 -_0": 1, "-_0 -_1 +_1": -1},
Copy link
Contributor

Choose a reason for hiding this comment

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

You swapped the order of the terms here, but you didn't add a minus sign.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for spotting this! #900 should address this bug 👍

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 normal_ordered and simplify should commute
4 participants