-
Notifications
You must be signed in to change notification settings - Fork 128
[BlockSparseArrays] Towards abelian block fusion #1326
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
Conversation
|
@ogauthe you were asking about ways of manipulating blocks of using NDTensors.GradedAxes: blockmergesortperm, fuse, gradedrange
d = gradedrange([U1(0) => 1, U1(1) => 1, U1(0) => 1])
d[[Block(1), Block(3), Block(2)]]
d[BlockVector([Block(1), Block(3), Block(2)], [2, 1])]
blockmergesortperm(d)
d[blockmergesortperm(d)]
fuse(d, d)which outputs: julia> using NDTensors.GradedAxes: blockmergesortperm, fuse, gradedrange
julia> d = gradedrange([U1(0) => 1, U1(1) => 1, U1(0) => 1])
3-element Vector{U1}:
U1(0)
U1(1)
U1(0)
isdual = false
3-blocked 3-element BlockedUnitRange{Vector{Int64}}:
1
─
2
─
3
julia> d[[Block(1), Block(3), Block(2)]]
3-element Vector{U1}:
U1(0)
U1(0)
U1(1)
isdual = false
3-blocked 3-element BlockedUnitRange{Vector{Int64}}:
1
─
2
─
3
julia> d[BlockVector([Block(1), Block(3), Block(2)], [2, 1])]
2-element Vector{U1}:
U1(0)
U1(1)
isdual = false
2-blocked 3-element BlockedUnitRange{Vector{Int64}}:
1
2
─
3
julia> blockmergesortperm(d)
2-blocked 3-element BlockVector{Block{1, Int64}}:
Block(1)
Block(3)
────────
Block(2)
julia> d[blockmergesortperm(d)]
2-element Vector{U1}:
U1(0)
U1(1)
isdual = false
2-blocked 3-element BlockedUnitRange{Vector{Int64}}:
1
2
─
3
julia> fuse(d, d)
3-element Vector{U1}:
U1(0)
U1(1)
U1(2)
isdual = false
3-blocked 9-element BlockedUnitRange{Vector{Int64}}:
1
2
3
4
─
5
6
7
8
─
9 |
Codecov ReportAttention:
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #1326 +/- ##
===========================================
- Coverage 84.23% 53.14% -31.10%
===========================================
Files 106 97 -9
Lines 8841 8020 -821
===========================================
- Hits 7447 4262 -3185
- Misses 1394 3758 +2364 ☔ View full report in Codecov by Sentry. |
|
Really interesting - I like the interface |
|
In the latest I added support for |
|
Great, so basically does everything needed for Abelian symmetric tensors except some optimizations related to merging blocks (I guess merging them in the sense of permuting and merging the blocking inside the axes)? |
|
This PR introduced permuting sectors to put common sectors next to each other. As you can see in the first post, the output of The current implementation doesn't merge the adjacent |
|
All makes sense - thanks! |
|
Concerning |
|
Agreed, I was just keeping the code simpler for now but we can add checks like that. |
This PR makes progress towards abelian symmetric block fusion.
splitdims(::SectorFusion, ::BlockSparseArray, ...), the inverse operation offusedims(::SectorFusion, ::BlockSparseArray, ...). This will fix the failing symmetric contraction tests.This is the current functionality:
which outputs:
Output
@emstoudenmire @ogauthe