JuliaArrays / UnsafeArrays.jl

Stack-allocated pointer-based array views
Other
42 stars 5 forks source link

Any interest in a uvec method? #6

Closed m-wells closed 4 years ago

m-wells commented 4 years ago

Is there any interest in a uvec method? I imagine it would be something like

uvec(x::AbstractArray) = uview(x, eachindex(x))
oschulz commented 4 years ago

You can already call vec on an UnsafeArray:

using UnsafeArrays
A = rand(4, 6)
@uviews A begin
    va = vec(A)
    va isa UnsafeArray{Float64,1}
end

So I don't think we need a special uvec function. Also, in general, uview should rarely be used directly - use the @uviews macro instead, it protectd the original arrays from GC.

oschulz commented 4 years ago

If you had something more specialized in mind, though, please feel free to reopen this issue, @m-wells!