JuliaArrays / JuliaArrays/BlockArrays.jl
Generic interface for constructing `AbstractBlockArray`s: `blocked(a::AbstractArray, blocklengths...)`
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 254
- Forks
- 39
- PR merge metrics
- No merged PRs in 30d
Description
This is a proposal for a new generic function for constructing block arrays, blocked(a::AbstractArray, blocklengths...), which takes an AbstractArray a and block lengths blocklengths, one for each dimension, and outputs the closest reasonable AbstractBlockArray. It would be a generalization of the corresponding BlockArray and PseudoBlockArray constructors, and could make a PseudoBlockArray as a fallback.
This could be used for making BlockedUnitRanges with blocked(1:7, [4, 3]) == blockedrange([4, 3]) and BlockedOneTo (being developed in #348) with blocked(Base.OneTo(7), [4, 3]). It may also call for defining BlockedUnitRange(1:7, [4, 3]) and BlockedOneTo(Base.OneTo(7), [4, 3]), again analogous to the BlockArray and PseudoBlockArray constructors, but I'm not sure if that is needed.
blocked(a::AbstractArray, blocklengths...) would be very similar to a[blockedrange.(blocklengths)...], however, so maybe it isn't needed and that is the preferred syntax for this operation. However, blocked could make a view while a[blockedrange.(blocklengths)...] copies.
See https://github.com/JuliaArrays/BlockArrays.jl/issues/347#issuecomment-2025279048 for a related discussion.
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
Begin with the existing BlockArray and PseudoBlockArray constructors and blockedrange behavior; compare the proposed blocked(a::AbstractArray, blocklengths...) API with a[blockedrange.(blocklengths)...]. Review the related discussion in issue #347 and the BlockedOneTo work in #348, then establish whether the constructor should exist and whether it should produce a view or copy.
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
- Needs clarification
- Newbie friendliness
- 25/100