We can resize a vector of static arrays:
julia> v = [ rand(SVector{3,Float64}) for _ in 1:2 ];
julia> resize!(v, 3)
3-element Vector{SVector{3, Float64}}:
[0.49021421932808495, 0.04375803657360211, 0.6957281082155673]
[0.08420472085130659, 0.6281088019727706, 0.004126731413303553]
[0.0, 0.0, 0.0]
AFAIU, a (3,N) matrix has the same memory layout, thus, effectively, we can reinterpret such a matrix as a vector of SVectors:
julia> x = rand(3,2)
3×2 Matrix{Float64}:
0.948469 0.260338
0.773314 0.616487
0.0618051 0.279425
julia> y = reinterpret(reshape, SVector{3,Float64}, x)
2-element reinterpret(reshape, SVector{3, Float64}, ::Matrix{Float64}) with eltype SVector{3, Float64}:
[0.948469068098922, 0.7733139138943798, 0.06180507432707616]
[0.2603384894132955, 0.6164869874966521, 0.2794245241939306]
Why can’t we resize!
that resulting reinterpreted vector of SVectors? (or, similary, why can’t we add or remove columns from a matrix?). Or, if there is intrinsic reasons for that not being possible, why can we resize!
the vector of SVectors in the first place?