-
Notifications
You must be signed in to change notification settings - Fork 64
Closed
Description
using SparseArrays,StaticArrays
julia> T=SMatrix{2,2,Float64};
julia> s=sparse(1:10,1:10,fill(zero(T), 10));
julia> nnz(s)
10
julia> nnz(sparse(Matrix(s)))
100
This is just an example, there are other methods that don't work quite as they should (e.g. setindex!
) The problem seems to be that the code for sparse matrices is riddled with != 0
checks instead of !iszero
checks. This seems related to JuliaLang/julia#19561, but in that case the problem was for types without zero(T)
for which sparse does not make real sense anyway. Maybe it would be reasonable to enforce the value type <: Number
for SparseMatrixCSC
? Are there people using it for non-number types? In that case one could fix all the != 0
instances and see if things work...
Metadata
Metadata
Assignees
Labels
No labels