JuliaArrays / JuliaArrays/BlockArrays.jl
Add support for multiple layers of block arrays
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 254
- Forks
- 39
- PR merge metrics
- No merged PRs in 30d
Description
It's sometimes useful to have multiple layers of blocks, see conversation in
https://github.com/JuliaDiffEq/MultiScaleArrays.jl/issues/25
I think one way to do this would be to support some sort of BlockView that converts an AbstractBlockVector{T} into an AbstractVector{Vector{T}}:
struct BlockView{AT, p, BA <: AbstractBlockArray} <: AbstractArray{AT, p}
data::BA
end
_BlockView(data::BA) where BA<:AbstractBlockArray{T,p} where T = BlockView{Array{T,p},p,BA}(data)
getindex(A::BlockView, i...) = A[Block(i...)]
size(A::BlockView) = nblocks(A)
Then one create a hierarchical block array view (here we have sub-blocks of length 10 and super-blocks of length 5):
A_sub = PseudoBlockArray(randn(10*5*n), fill(10,5n))
A = PseudoBlockArray(BlockView(A_sub), fill(5,n))
A[Block(2)][3] # returns the 3rd sub-block of the 2nd super-block
I'm still working out how to get it to work with A[Block(2)][Block(3)]...
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read the linked MultiScaleArrays discussion, then inspect AbstractBlockArray, PseudoBlockArray, BlockView, Block, and the existing indexing behavior. Define how hierarchical block arrays should be represented and how both A[Block(2)][3] and A[Block(2)][Block(3)] should behave; done means multiple block layers work consistently with the stated examples.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- data
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100