You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a proposal for a new generic function for constructing block arrays, blocked(a::AbstractArray, blocklengths...), which takes an AbstractArraya 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.
This is a proposal for a new generic function for constructing block arrays,
blocked(a::AbstractArray, blocklengths...)
, which takes anAbstractArray
a
and block lengthsblocklengths
, one for each dimension, and outputs the closest reasonableAbstractBlockArray
. It would be a generalization of the correspondingBlockArray
andPseudoBlockArray
constructors, and could make aPseudoBlockArray
as a fallback.This could be used for making
BlockedUnitRange
s withblocked(1:7, [4, 3]) == blockedrange([4, 3])
andBlockedOneTo
(being developed in #348) withblocked(Base.OneTo(7), [4, 3])
. It may also call for definingBlockedUnitRange(1:7, [4, 3])
andBlockedOneTo(Base.OneTo(7), [4, 3])
, again analogous to theBlockArray
andPseudoBlockArray
constructors, but I'm not sure if that is needed.blocked(a::AbstractArray, blocklengths...)
would be very similar toa[blockedrange.(blocklengths)...]
, however, so maybe it isn't needed and that is the preferred syntax for this operation. However,blocked
could make a view whilea[blockedrange.(blocklengths)...]
copies.See #347 (comment) for a related discussion.
The text was updated successfully, but these errors were encountered: