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

[BUG] Broadcasting assignments are not working #19

Closed
lkdvos opened this issue Jan 14, 2025 · 2 comments · Fixed by #21
Closed

[BUG] Broadcasting assignments are not working #19

lkdvos opened this issue Jan 14, 2025 · 2 comments · Fixed by #21
Labels
bug Something isn't working

Comments

@lkdvos
Copy link
Contributor

lkdvos commented Jan 14, 2025

MWE:

using SparseArraysBase
a = SparseArraysBase.SparseArrayDOK{Float64}(2,2)
a[1] = 1
julia> a
2×2 SparseMatrixDOK{Float64, typeof(SparseArraysBase.default_getunstoredindex)}:
 1.0  
     

julia> a .*= 2
2×2 SparseMatrixDOK{Float64, typeof(SparseArraysBase.default_getunstoredindex)}:
 0.0  
     
@lkdvos lkdvos added the bug Something isn't working label Jan 14, 2025
@mtfishman
Copy link
Member

Reminder to simplify the code introduced in #18 once this is fixed.

@mtfishman
Copy link
Member

mtfishman commented Jan 15, 2025

It looks like the offending line is this one:

@interface interface zero!(a_dest)

We have to zero out the destination if it has values that won't get overwritten when mapping over the stored values of the source arrays, but that obviously goes wrong if the destination is aliased with one or more of the sources.

We'll have to add some unaliasing logic like in Base.Broadcast.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants