I have an array A
of type Array{T, N}
. I want a view of A
but for various reasons I don’t want to deal with SubArray
. Is there a way to get a view of A
a la view(A, ...)
but not as a SubArray
but as Array{T, N}
? I don’t mind if it is not as fast as a SubArray
.
You can’t generalize the function of your view to take AbstractArray{T,N}?
Why not take an actual slice instead of a view? Slicing returns an array.
2 Likes
It is not about a function definition but about parametrized types. I don’t want another type parameter.
Slicing also returns a SubArray
on julia 0.5 and an error for >= 0.6.
I don’t think it is possible to do what I want, but I wanted to make sure I am not missing something obvious.
I don’t think it’s possible since Array
doesn’t support general strides (as far as I know).
If you are taking a view of rows contained in a single column, it is possible using pointer arithmetic, but a very bad idea. Much better to just add another templates variable.