-
Notifications
You must be signed in to change notification settings - Fork 8
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
Correct dealiasing in minimal_callsafe_copy
#269
Conversation
comments GFUnit type fix whitespace minimal_callsafe_copy(s::GreenSlicer) fallback don't call! when indexing ph[hybrid(...)] test fixes test fix test fix comments
minimal_callsafe_copy
minimal_callsafe_copy
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #269 +/- ##
==========================================
- Coverage 92.44% 92.41% -0.03%
==========================================
Files 37 37
Lines 6061 6091 +30
==========================================
+ Hits 5603 5629 +26
- Misses 458 462 +4 ☔ View full report in Codecov by Sentry. |
A twist to this plot: In a MWE julia> glead = LP.linear() |> @onsite((; o = 1) -> o) - hopping(1) |> greenfunction(GS.Schur(boundary = 0));
julia> g = LP.linear() |> -hopping(1) |> supercell |> attach(glead) |> greenfunction;
julia> g´ = Quantica.minimal_callsafe_copy(g);
julia> g´(0, o = 0)[] # should be a finite number, but contacts don't update anymore
1×1 OrbitalSliceMatrix{Matrix{ComplexF64}}:
NaN + Inf*im |
So from this the following general rule is extracted that clarifies this whole PR. The allowed aliasing relations are strictly the following:
This begs the question: why shouldn't we move |
05652f3
to
28c0b61
Compare
comments add test
28c0b61
to
49a538b
Compare
Closes #267
We use the approach described in that issue: redefine
minimal_callsafe_copy
methods throughout Quantica to restore aliasing relations between subparts of objects, particularly betweenGreenSolvers
and any parentph::ParametricHamiltonian
.We also fixed a silly bug that called
call!
on eachph[hybrid(dn)]
indexing, so this might even improve performance a bit. I didn't profile any potential allocations regressions of the PR. The changes are subtle and hence a bit risky.