BlockArrays.jl
BlockArrays.jl copied to clipboard
`typeof(zero(x)) != typeof(x)` for BlockVector
julia> using BlockArrays
julia> using BlockArrays: BlockedOneTo
julia> b = BlockVector([1,2,3,4,5,6,7,8,9,10], (BlockedOneTo(5:5:10),));
julia> typeof(b) == typeof(zero(b))
false
julia> typeof(b)
BlockVector{Int64, Vector{Vector{Int64}}, Tuple{BlockedOneTo{Int64, StepRange{Int64, Int64}}}} (alias for BlockArray{Int64, 1, Array{Array{Int64, 1}, 1}, Tuple{BlockedOneTo{Int64, StepRange{Int64, Int64}}}})
julia> typeof(similar(b))
BlockVector{Int64, Vector{Vector{Int64}}, Tuple{BlockedOneTo{Int64, Vector{Int64}}}} (alias for BlockArray{Int64, 1, Array{Array{Int64, 1}, 1}, Tuple{BlockedOneTo{Int64, Array{Int64, 1}}}})
I think the issue is because typeof(similar(b)) != typeof(b)
in this case, since it collects the axes
julia> axes(b)
(BlockedOneTo(5:5:10),)
julia> axes(similar(b))
(BlockedOneTo([5, 10]),)
Would this be a bug? Should it preserve the axes?