LabelledArrays.jl icon indicating copy to clipboard operation
LabelledArrays.jl copied to clipboard

One label for more than one contiguous entry

Open BenjaminBorn opened this issue 7 years ago • 1 comments

Sorry for asking here, feel free to close if this is not the appropriate place.

Let's say I have the vector A = [1, 2, 3, 4] but I want to put the first two entries under one label. Essentially: A1.a=A[1:2]. If I do

using LabelledArrays
ABC = @SLVector (:a, :b, :c)
A1 = ABC([1, 2], 3, 4)

I get 3-element SLArray{Tuple{3},1,(:a, :b, :c),Any}, so it's of type Any, instead of 3-element SLArray{Tuple{3},1,(:a, :b, :c),Int64}

Is that performant or is there a better way to do this? Or is it outside the scope of this package?

BenjaminBorn avatar Nov 13 '18 16:11 BenjaminBorn

LabelledArray accepts AbstractArray pieces, so if you made an abstract array which handles this well then it would likely work in a LabelledArray. Off the top of my head I don't know of one which fits this though.

ChrisRackauckas avatar Nov 13 '18 17:11 ChrisRackauckas