-
Notifications
You must be signed in to change notification settings - Fork 125
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
[BlockSparseArrays] More general broadcasting and slicing #1332
Conversation
NDTensors/src/lib/BlockSparseArrays/src/abstractblocksparsearray/map_mismatched_blocking.jl
Outdated
Show resolved
Hide resolved
NDTensors/src/lib/BlockSparseArrays/src/abstractblocksparsearray/map_mismatched_blocking.jl
Outdated
Show resolved
Hide resolved
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main ITensor/ITensors.jl#1332 +/- ##
===========================================
- Coverage 84.40% 53.78% -30.62%
===========================================
Files 100 99 -1
Lines 8581 8528 -53
===========================================
- Hits 7243 4587 -2656
- Misses 1338 3941 +2603 ☔ View full report in Codecov by Sentry. |
map!
with mismatched blockingmap!
with mismatched blocking
map!
with mismatched blockingmap!
Very cool! |
@ogauthe @emstoudenmire I'm merging this. The status is that you should be able to perform arbitrary broadcasting operations (adding, scalar multiplication, permutations) of block sparse arrays, as well as perform pretty general slicing operations, and it should preserve block structures and block labels stored on the axes (including symmetry labels). It also needs more tests, but I want to merge this now as a starting point for future work. I'm sure there will be corner cases and bugs to work out as it is put into practice but I think it is a good starting point. |
map!
This is work in progress for defining
map!
forBlockSparseArray
s with mismatched blocking.This is functionality that is required to perform block fusion, as a follow-up to #1326.
So far, it performs some unnecessary copying, and also only works with one input array, which both should be relatively easy fixes.
a + b
, currently it outputs a block sparse array withaxes(a)
. If the axes/blocking ofa
andb
are different, it should combine the axes (i.e. output a block sparse array with a finer blocking structure compatible with the blocking ofa
andb
).map(+, a, b)
outputs a dense block array, not a block sparse array.GradedAxes
as axes of block sparse arrays and performing mapping/broadcasting operations. There are some lingering bugs with that, and we need to make sure we preserve the sectors of the graded axes properly.map!
functionality to arbitrary number of input arrays.BlockSparseArray
).A demonstration of new functionality:
which outputs:
so it can handle cases where the blocking doesn't line up, while before this would have errored.
It works by first creating axes with a finer blocking structure that lines up with the blocking structure of the destination and source arrays, and then applies block-wise operations using that finer blocking structure.