-
Notifications
You must be signed in to change notification settings - Fork 33
Preserve block information in more slicing operations #459
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
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #459 +/- ##
==========================================
+ Coverage 93.64% 93.66% +0.02%
==========================================
Files 19 19
Lines 1667 1673 +6
==========================================
+ Hits 1561 1567 +6
Misses 106 106 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
I assume I'll have to add more methods for |
src/blockindices.jl
Outdated
@@ -288,6 +288,16 @@ _indices(B) = B | |||
|
|||
Block(bs::BlockSlice{<:BlockIndexRange}) = Block(bs.block) | |||
|
|||
struct BlockInds{BB,T<:Integer,INDS<:AbstractVector{T}} <: AbstractVector{T} |
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.
Can you add a docstring so I know what this is meant to do?
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.
Can do. I was holding off doing "final touches" like that to get your reaction if this is something you want in the first place (and get feedback on the name).
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 can't react to something I don't understand 😅
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.
Gotcha, I thought I described it in the first comment of the PR but I can add a docstring as well.
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've added a docstring along with some tests, let me know if that helps to clarify the purpose of this object. I changed the name to BlockedSlice
but I'm not so happy with that and again I'm open to suggestions.
This introduces a generalization of
BlockSlice
for views involving vectors ofBlock
andBlockIndexRange
, building off of #445.I call it
BlockedSlice
but I'm open to suggestions. At first I tried to just generalizeBlockSlice
to be anAbstractVector
subtype but some operations depend on it being anAbstractUnitRange
so I think it makes sense to have both.The motivation is that in https://github.com/ITensor/BlockSparseArrays.jl it would be helpful to preserve information about the original blocks being sliced when taking views involving vectors of
Block
andBlockIndexRange
. #445 drops the blocks input in the slice operation, so it is hard to tell if a certain slice operation was really originally blockwise.@dlfivefifty curious to hear your thoughts on this since you wrote #445.