Oh wait, I was referring to Vec from FixedSizeArrays.jl , not from SIMD
> On 16 Nov. 2016, at 6:39 pm, Gunnar Farnebäck <gun...@lysator.liu.se> wrote: > > Is this what you're looking for? > > julia> using SIMD > > julia> v = rand(2, 5) > 2×5 Array{Float64,2}: > 0.391832 0.785861 0.352291 0.874891 0.874593 > 0.697768 0.51637 0.711525 0.400077 0.266559 > > julia> w = reinterpret(Vec{2, Float64}, vec(v)) > 5-element Array{SIMD.Vec{2,Float64},1}: > Float64⟨0.391832,0.697768⟩ > Float64⟨0.785861,0.51637⟩ > Float64⟨0.352291,0.711525⟩ > Float64⟨0.874891,0.400077⟩ > Float64⟨0.874593,0.266559⟩ > > > Den onsdag 16 november 2016 kl. 05:52:14 UTC+1 skrev Sheehan Olver: > > In some high performance code I want to convert an 2 x n `Matrix{Float64}` to > a n long `Matrix{Vec{2,Float64}}`with no memory allocation (both types will > store memory in the same order). The following works: > > v=rand(2,100) > w=unsafe_wrap(Vector{Vec{2,Float64}}, > reinterpret(Ptr{Vec{2,Float64}},pointer(v)), > size(pts,1),true) > > The variable v is a throw away variable, however, and as I understand it, the > way its written the memory for w will be freed as soon as v is no longer > referenced. Is there any way to tell the garbage collector to not collect v?