Bitstype homonyms?


#1

I have a 64-bit bitstype that is bit-equivalent to Float64 and does math as Float64 does. I can reinterpret one to the other. I would like to do something reinterpret-like with vectors and matricies (maybe StaticArrays) formed thereof. The goal is to avoid copying (in both directions) by some-sort-of type punning. With the understanding that this is unsafe and would be an internal mechanism only, is there a way?


#2

Do you mean something like:

julia> reinterpret(SVector{5, Float64}, rand(5,5), (5,1))
5×1 Array{StaticArrays.SVector{5,Float64},2}:
 [0.26857,0.50109,0.820086,0.164511,0.861485]    
 [0.268779,0.0418737,0.0973738,0.478333,0.926014]
 [0.395503,0.147222,0.153111,0.0439762,0.751799] 
 [0.0218796,0.725483,0.306756,0.272246,0.346762] 
 [0.954175,0.492579,0.392173,0.0514481,0.536747] 

?


#3

@kristoffer.carlsson Now I see it. Thank you.