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

Related issues

omus picture omus  Â·  3Comments

StefanKarpinski picture StefanKarpinski  Â·  3Comments

StefanKarpinski picture StefanKarpinski  Â·  3Comments

tkoolen picture tkoolen  Â·  3Comments

helgee picture helgee  Â·  3Comments