Open bgctw opened 2 years ago
I don't think it should in cases where indexing into the underlying array creates a new array type. OffsetArrays
, for example, returns a plain Array
when indexing into it. More than anything, though, it's just surprisingly difficult to reconstruct arbitrary array types. I've tried multiple times to get something similar working where you could have inner components that were different array types and it would rewrap them when you accessed the component. The fact that many common array types don't encode all of the information in the type domain required to convert
back to them from a plain Array
made this too difficult for me to figure out.
ok, I see.
Would it be possible to support returning StaticVectors on KeepIndex indexing as a special case? This would be a common case with DifferentialEquations.jl for not-too-large state and parameter vectors.
Currently, KeepIndex subsetting on a ComponentVector based on LabelledVector or OffsetArray returns a ComponenVector based on plain Vector.
Contrary, it does preserve the type for NamedArrays.
When should the underlying AbstractArray type be preserved and when not?