I am creating a struct
that contains an array, and views
into this array. I need to specify the type of the view when declaring the struct
, but:
julia> X = rand(10,5,6);
julia> typeof(@view X[:,:,1:4])
SubArray{Float64,3,Array{Float64,3},Tuple{Base.Slice{Base.OneTo{Int64}},Base.Slice{Base.OneTo{Int64}},UnitRange{Int64}},true}
The type of the view is a very complicated thing. I defined my own:
const ViewType = SubArray{T, N, Array{T,N},
Tuple{Base.Slice{Base.OneTo{Int64}},
Base.Slice{Base.OneTo{Int64}},
UnitRange{Int64}}, true
} where {T,N}
to work around this. But maybe there is already a definition like this in Julia that I am overlooking? Or a better way of doing what I want?