Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OffsetArray broadcast of sparse vector tries to construct dense array #299

Open
Keno opened this issue Jun 4, 2022 · 1 comment
Open

Comments

@Keno
Copy link
Contributor

Keno commented Jun 4, 2022

julia> using SparseArrays

julia> using OffsetArrays: Origin

julia> svec = SparseVector{Int, Int}(div(typemax(Int),2), Int[], Int[])
4611686018427387903-element SparseVector{Int64, Int64} with 0 stored entries

julia> svec .- svec
4611686018427387903-element SparseVector{Int64, Int64} with 0 stored entries

julia> Origin(0)(svec) .- Origin(0)(svec)
ERROR: invalid Array size
@jishnub
Copy link
Member

jishnub commented Jun 5, 2022

Seems related to

# TODO: Ideally we would delegate to the parent's broadcasting implementation, but that
# is currently broken in sufficiently many implementation, namely RecursiveArrayTools, DistributedArrays
# and StaticArrays, that it will take concentrated effort to get this working across the ecosystem.
# The goal would be to have `OffsetArray(CuArray) .+ 1 == OffsetArray{CuArray}`.
# Base.Broadcast.BroadcastStyle(::Type{<:OffsetArray{<:Any, <:Any, AA}}) where AA = Base.Broadcast.BroadcastStyle(AA)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants