Skip to content

[BUG] Wrong answer in sparse_mul! #17

Description

@lkdvos

Currently, the code for sparse_mul! contains a small error. Whenever there are multiple entries contributing to a single output, the beta parameter will in fact be used that many times.

MWE

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

julia> a * a
2×2 SparseMatrixDOK{Float64, typeof(SparseArraysBase.default_getunstoredindex)}:
 1.0  1.0
 1.0  1.0

julia> Array(a) * Array(a)
2×2 Matrix{Float64}:
 2.0  2.0
 2.0  2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions