Skip to content

Fix add_physical_charge for fermionic operators#253

Merged
leburgel merged 4 commits intomasterfrom
lb/fix_charge_shift
Sep 19, 2025
Merged

Fix add_physical_charge for fermionic operators#253
leburgel merged 4 commits intomasterfrom
lb/fix_charge_shift

Conversation

@leburgel
Copy link
Member

@leburgel leburgel commented Sep 8, 2025

Fixes #259.

Instead of applying a flip to the auxiliary space to get rid of the dual (which would also be correct I think), I decided to change the underlying contraction such that it no longer makes implicit assumptions on the auxiliary space.

@codecov
Copy link

codecov bot commented Sep 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
src/operators/localoperator.jl 87.61% <100.00%> (-0.11%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@leburgel leburgel requested a review from lkdvos September 9, 2025 14:30
lkdvos
lkdvos previously approved these changes Sep 9, 2025
Copy link
Member

@lkdvos lkdvos left a comment

Choose a reason for hiding this comment

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

Do we have some kind of test coverage for this, or any way to actually check that things keep working properly in the meantime?
I'm definitely happy to keep things like this if that is just too much work for now, just wanted to ask.

@leburgel
Copy link
Member Author

leburgel commented Sep 9, 2025

The coverage is from the Bose-Hubbard test, so that doesn't catch this unfortunately. I removed the Fermi-Hubbard example test because the compilation time was ridiculous and always hitting the time limit.

We could add a regression test that doesn't do any actual optimization but just checks operators directly. Maybe leave this open for now, I'll see if I can think of something tomorrow.

@leburgel leburgel requested a review from lkdvos September 18, 2025 17:25
@leburgel leburgel enabled auto-merge (squash) September 18, 2025 19:20
Copy link
Member

@lkdvos lkdvos left a comment

Choose a reason for hiding this comment

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

Cool, thanks for fixing and adding the tests!

@leburgel leburgel merged commit 5a0bbd1 into master Sep 19, 2025
51 checks passed
@leburgel leburgel deleted the lb/fix_charge_shift branch September 19, 2025 08:13
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.

Bug in add_physical_charge for fermionic operators

2 participants