-
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
GreenFunction indexing refactor #315
Conversation
51b499d
to
86f53fb
Compare
fix dispatch indexing fix fix dispatch fix GreenSlice constructor
86f53fb
to
cc40246
Compare
c101107
to
e8db7e9
Compare
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 #315 +/- ##
==========================================
- Coverage 92.90% 92.59% -0.31%
==========================================
Files 38 38
Lines 6678 6819 +141
==========================================
+ Hits 6204 6314 +110
- Misses 474 505 +31 ☔ View full report in Codecov by Sentry. |
cd15e11
to
f9a47b2
Compare
going through tests working through tests fixing and adding tests several fixes sitepairs test removed docstring test fixed doctest fix test
f9a47b2
to
6f28c90
Compare
69ad655
to
f3e5213
Compare
This is a major cleanup and refactor of the indexing machinery of
GreenFunctions
. It is relatively risky, with subtle behavioral changes.User-facing changes
OrbitalSliceArray
whenever the indexing aGreenSolution
contains enough information to do so. That means "always" except when indexing withsites
, as ing(0.2)[diagonal(sites(1))]
org(0.3)[sites(SA[1],2:3)]
diagonal
indexing now returns aDiagonal
matrix or aOrbitalSparseMatrix
override
keyword indensitymatrix
andjosephson
is now calledoverride_path
siteindexdict
is now exported (to be paired withorbaxes
, which is exported and now also documented).New features
hopselector
using thesitepairs
function.g(0.2)[sitepairs(range = 2)]
will return a sparse OrbitalSliceMatrix withgᵢⱼ
for any sitej
in cell zero and any sitei
within a distance of 2 to anyi
. We can also usesitepairs(::HopSelector)
. This functionality will allow efficient non-local mean field calculations in an upcoming PR. In the future, sparse observables such ascurrent
should move to using this mechanism too.Internal changes
SparseIndices
: The sparse indexing machinery (bothdiagonal
andsitepairs
) relies on a commonSparseIndices
type, and a set of new codepaths for them. These are designed to be also used to index other objectso
that just need to definegetindex(o, ::CellOrbitals, ::CellOrbitals)
methods. One example isEigenProduct
, used byGS.Spectrum
, which represents the productΨf(ϵ)Ψ'*e^{iϕdn}'
in terms of eigenpairsϵ, Ψ
without computing the product explicitly.GreenSlice
output: Ags::GreenSlice
is a lazy wrapper of ag::GreenFunction
and someGreenIndices
. Here we add a new fieldoutput
, which is a preallocatedAbstractArray
that is the output ofcall!(gs, ω; params...)
. This is not really done for performance reason (the gain is small, as the main runtime is spent finding theGreenSolution
g(ω; params...)
, but rather for organization purposes: the complicated issue of what kind ofAbstractArray
should be produced and of what size is now gathered cleanly in theGreenSlice
constructor. Also it allows to introduce thegetindex!(output, g::GreenSolution, inds...)
method, which will be useful when we need to extend it in the general mean-field machinery (whereg
will be swapped for aDensityMatrix
)