Skip to content
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

Replace getblock(A, k) with view(A, Block(k)) #138

Closed
dlfivefifty opened this issue Nov 23, 2020 · 0 comments
Closed

Replace getblock(A, k) with view(A, Block(k)) #138

dlfivefifty opened this issue Nov 23, 2020 · 0 comments

Comments

@dlfivefifty
Copy link
Member

We have two different versions of getting a block without copying: getblock(A, k::Int...) and view(A, ::Block...). I propose deprecating getblock and having the canonical version the latter. Note this would mean view does not (always) return a SubArray, but this is fine:

julia> view(2:5, 2:3) # returns a range as type is immutable
3:4

Note this might break some code: I recall for PseudoBlockArray purposefully adding BlockSlice to retain the information about which block a range was coming from. I don't exactly recall why this was necessary, but I suspect it was for BlockBandedMatrices.jl where we needed to recognise that view(A, Block(K,J)) was banded. That said, with the proposed redesign this will return a BandedMatrix which is even nicer. And probably when I designed the code I thought it wasn't allowed to return something other than a SubArray, but my view has changed as of an hour ago.

Cf JuliaLang/julia#38536 JuliaLang/julia#38536

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant