Open
Description
For example using FillArrays v1.9.3
:
julia> using FillArrays
julia> cumsum(Ones{Int64}(4))
Base.OneTo(4)
julia> cumsum(Ones{Int32}(4))
4-element Vector{Int32}:
1
2
3
4
I believe the issue is this line: https://github.com/JuliaArrays/FillArrays.jl/blob/v1.9.3/src/FillArrays.jl#L578.
It may in fact be an issue with convert
of Base.OneTo
:
julia> convert(AbstractVector{Int64}, Base.OneTo(4))
Base.OneTo(4)
julia> convert(AbstractVector{Int32}, Base.OneTo(4))
4-element Vector{Int32}:
1
2
3
4
i.e. it seems like it should preserve that it is Base.OneTo
and just change the element type. A workaround could be to use:
cumsum(x::AbstractOnesVector{II}) where II<:Integer = convert(AbstractVector{II}, oneto(II(length(x))))
Metadata
Metadata
Assignees
Labels
No labels