Is it possible to remove explicit zero value from sparse matrix in Julia?
Namely, I want to convert a=sparse([1],[1],[0])
into b=spzeros(1,1)
Yes: see dropzeros
:
julia> a=sparse([1],[1],[0])
1×1 SparseMatrixCSC{Int64,Int64} with 1 stored entry:
[1, 1] = 0
julia> dropzeros(a)
1×1 SparseMatrixCSC{Int64,Int64} with 0 stored entries
Or you can do it in place (modifying a
) with dropzeros!
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With