Julia: Sparse matrix allows for duplicate entries

Created on 17 Feb 2017  路  1Comment  路  Source: JuliaLang/julia

The representation of sparse matrices allow for duplicates. This seems prone to errors, for instance computing the number of non-zeros entries would be incorrect.

Since this is not allowed in full matrices, does it make any sense to have this be the behavior for sparse matrices?

julia> a = spzeros(2, 3)
2脳3 SparseMatrixCSC{Float64,Int64} with 0 stored entries

julia> a[[1,1,1,1,1,1],2]=1
1

julia> a
2脳3 SparseMatrixCSC{Float64,Int64} with 6 stored entries:
  [1, 2]  =  1.0
  [1, 2]  =  1.0
  [1, 2]  =  1.0
  [1, 2]  =  1.0
  [1, 2]  =  1.0
  [1, 2]  =  1.0
bug sparse

Most helpful comment

Looks like a bug in setindex!?

>All comments

Looks like a bug in setindex!?

Was this page helpful?
0 / 5 - 0 ratings