-
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] Redesign nested views #1504
Conversation
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#1504 +/- ##
===========================================
- Coverage 78.06% 60.78% -17.29%
===========================================
Files 148 148
Lines 9655 9646 -9
===========================================
- Hits 7537 5863 -1674
- Misses 2118 3783 +1665 ☔ View full report in Codecov by Sentry. |
To-do:
@test_broken
.Currently, when taking views of views of
BlockSparseArray
s, the result is sometimes nested views:These nested views can become challenging to deal with. The goal of this PR will be to flatten them down to a single view.
The goal is basically to make use of more of the generic
view
logic in Base Julia (i.e. in https://github.com/JuliaLang/julia/blob/master/base/subarray.jl), which flattens views using a functionreindex
. The primary customization point for howreindex
behaves is by overloading theto_indices
function.BlockArrays.jl
has a lot of usefulto_indices
definitions forBlock
and other related types in https://github.com/JuliaArrays/BlockArrays.jl/blob/master/src/views.jl, but some are missing for operations we want, so the goal here is to write a minimal number ofto_indices
overloads to complement the ones already in Base or BlockArrays.This is a follow-up to #1503 but will provide a more systematic fix to those kinds of issues. Additionally, the goal is to fix a few of slicing bugs listed in ITensor/BlockSparseArrays.jl#2, and also those marked as broken in the BlockSparseArrays tests: https://github.com/ITensor/ITensors.jl/blob/v0.6.14/NDTensors/src/lib/BlockSparseArrays/test/test_basics.jl.