Reinterpret SVector


Hello everyone,

I’ve got a question regarding the usage of reinterpret in combination with StaticArrays.SVector:
As described in the readme something like
x = rand(3,3)
reinterpret(SVector{3,Float64}, x, (3,))
works, but the other way round it won’t work:

x = [SVector{3,Float64}(rand(3)) for i = 1:3]
reinterpret(Matrix{Float64}, x, (3,3))

Is it possible to reinterpret a Vector of SVectors as a Matrix{Float64}?

Thank you in advance
Best, Max

Reinterpret examples for converting Julia multi-dimensional arrays and StaticArrays
x = [SVector{3, Float64}(rand(3)) for i = 1:3]
y = reinterpret(Float64, x, (3, 3))

The first argument to reinterpret should be the type of the element of the resulting array (i.e., the result of eltype(y).


That makes sense!
Thank you!