-
Notifications
You must be signed in to change notification settings - Fork 33
Closed
Description
I've always felt the design for block sizes is not very elegant, and the termonology is completely unintuitive (even after acting as primary maintainer for this package for several years). I believe a better design would move this to be part of the axes of an array. That is, we would have the following behaviour:
bs = [1,5,3] # block sizes
n = sum(bs) # total length of vector
x = BlockVector(randn(n), bs) # returns a Block vector with block-sizes [1,5,3]
a = axes(x,1)
a === BlockSlice(Base.OneTo(n), bs) # BlockSlice plays same role as `Slice`
length(a[Block(2)]) === 5 # returns the size of the second block
a[Block(2)][3] === 4 # returns the "global" index into `x` of the 3rd entry of the second block.
# This replaces blockindex2global:
x[a[Block(2)][3]] === x[4]Metadata
Metadata
Assignees
Labels
No labels