This is best illustrated by a simple example on v0.5-rc0:
julia> view(zeros(4,2),:,2)
4-element SubArray{Float64,1,Array{Float64,2},Tuple{Colon,Int64},true}:
0.0
0.0
0.0
0.0
julia> zeros(4,2)[:,2]
4-element Array{Float64,1}:
0.0
0.0
0.0
0.0
The first returns a SubArray of Array{Float64,2}
with only 1 column, but v0.5 drops dimensions. Is there a way to make the SubArray/View drop the unused dimension?
As Tasos mentioned, it's a view of an Array{Float64, 2}
, but the view itself is one-dimensional already. In fact,
julia> T = SubArray{Float64,1,Array{Float64,2},Tuple{Colon,Int64},true};
julia> T <: AbstractVector{Float64}
true
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments