-
Notifications
You must be signed in to change notification settings - Fork 57
Reduce cache footprint by decoupling degeneracy-dependent data #387
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
Open
lkdvos
wants to merge
12
commits into
main
Choose a base branch
from
ld-caching
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
48427d0
add utility to customize hashing/equality
lkdvos d038f96
split out fusionblockstructure and fusiontreelist
lkdvos 42d6a0c
use new split throughout the code
lkdvos 180ae2b
reorganize tensor structure computations
lkdvos 406db6e
update docstrings
lkdvos f4b2a56
switch to Dictionaries.Indices
lkdvos 80506df
switch even more to `Dictionaries.Dictionary`
lkdvos dfbcb87
remove fusiontreelist
lkdvos 0fac8ac
avoid storing fusiontrees in fusionblockstructure
lkdvos 543953d
clean cache separation
lkdvos 1a3893d
rename to subblockstructure
lkdvos 07ed7d5
some more simplifications
lkdvos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -96,6 +96,9 @@ sectors(P::ProductSpace) = _sectors(P, sectortype(P)) | |
| function _sectors(P::ProductSpace{<:ElementarySpace, N}, ::Type{Trivial}) where {N} | ||
| return OneOrNoneIterator(dim(P) != 0, ntuple(n -> Trivial(), N)) | ||
| end | ||
| function _sectors(P::ProductSpace{<:ElementarySpace, 0}, ::Type{I}) where {I <: Sector} | ||
| return Iterators.map(u -> (u,), allunits(I)) | ||
| end | ||
| function _sectors(P::ProductSpace{<:ElementarySpace, N}, ::Type{<:Sector}) where {N} | ||
| return product(map(sectors, P.spaces)...) | ||
| end | ||
|
|
@@ -147,23 +150,11 @@ that make up the `ProductSpace` instance. | |
| function blocksectors(P::ProductSpace{S, N}) where {S, N} | ||
| I = sectortype(S) | ||
| if I == Trivial | ||
| return OneOrNoneIterator(dim(P) != 0, Trivial()) | ||
| return dim(P) != 0 ? Indices([Trivial()]) : Indices(Trivial[]) | ||
| end | ||
| bs = Vector{I}() | ||
| if N == 0 | ||
| append!(bs, allunits(I)) | ||
| elseif N == 1 | ||
| for s in sectors(P) | ||
| push!(bs, first(s)) | ||
| end | ||
| else | ||
| for s in sectors(P) | ||
| for c in ⊗(s...) | ||
| if !(c in bs) | ||
| push!(bs, c) | ||
| end | ||
| end | ||
| end | ||
| bs = Indices{I}() | ||
| for s in sectors(P), c in ⊗(s...) | ||
| set!(bs, c) | ||
|
Comment on lines
+155
to
+157
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this covers the |
||
| end | ||
| return sort!(bs) | ||
| end | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find it a bit confusing if type parameters encode a function, that they still use capital letters. I was looking for a type called
Hash, before realising that this is actually the custom hash function encoded in the type. I understand that usinghashfor the type parameter is out of the question.A related question is whether you know if there is any benefits or downsides of this design compared to using the function as a field, i.e.
and then doing things like
h.hashf(parent(h), seed). I am asking because that is howInnerProductVecover at KrylovKit works, and if it has downsides (other than the stylistic differences), I should probably change this.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually don't think it does, if these are singleton types (like
Function) the size remains the same, so AFAIK this is equivalent and just a style choice. I'll refactor along with the required rebase :)