# Reinterpret SVector

**URL:** <https://discourse.julialang.org/t/reinterpret-svector/4996>\
**Category:** General Usage\
**Created:** [July 21, 2017, 11:00am UTC](https://discourse.julialang.org/t/reinterpret-svector/4996 "2017-07-21T11:00:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![StreetLevel](https://avatars.discourse-cdn.com/v4/letter/s/a8b319/32.png) [@StreetLevel](https://discourse.julialang.org/u/StreetLevel)\
**Post date:** [July 21, 2017, 11:00am UTC](https://discourse.julialang.org/t/reinterpret-svector/4996/1 "2017-07-21T11:00:13Z")

</div>

Hello everyone,

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

“”“julia  
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

---

<div class="post-metadata">

**Author:** ![oatlzzvztd](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oatlzzvztd/32/3285_2.png) [@oatlzzvztd](https://discourse.julialang.org/u/oatlzzvztd)\
**Post date:** [July 21, 2017, 12:14pm UTC](https://discourse.julialang.org/t/reinterpret-svector/4996/2 "2017-07-21T12:14:43Z")

</div>

```julia
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)`.

---

<div class="post-metadata">

**Author:** ![StreetLevel](https://avatars.discourse-cdn.com/v4/letter/s/a8b319/32.png) [@StreetLevel](https://discourse.julialang.org/u/StreetLevel)\
**Post date:** [July 27, 2017, 2:30pm UTC](https://discourse.julialang.org/t/reinterpret-svector/4996/3 "2017-07-27T14:30:18Z")

</div>

That makes sense!  
Thank you!
