I noticed that when doing hcat, I get varying output type based on the number of arguments. That is hcat(v, v) (where v is a ComponentVector) gives a ComponentMatrix, while hcat(v, v, v) gives a Matrix.
I think adding a method like below could resolve this:
function Base.hcat(vectors::ComponentVector{T,A,Tuple{Ax}}...) where {T,A,Ax}
return ComponentMatrix(hcat((getdata(v) for v in vectors)...), Ax(), FlatAxis())
end
happy to open a PR if you think that would work.
Minimal Example:
using ComponentArrays
c = ComponentVector(a=1)
display(hcat(c, c))
display(hcat(c, c, c))
Hi, thanks for the very useful package!
I noticed that when doing
hcat
, I get varying output type based on the number of arguments. That ishcat(v, v)
(wherev
is aComponentVector
) gives aComponentMatrix
, whilehcat(v, v, v)
gives aMatrix
.I think adding a method like below could resolve this:
happy to open a PR if you think that would work.
Minimal Example: