How to "unset" entries in sparse array?

Consider this example:

x = spzeros(5,5)
x[1,1] = 1.0
x[1,1] = 0.0

Now x holds the entry at 1,1, although it is zero:

julia> x
5×5 sparse matrix with 1 Float64 nonzero entries:
	[1, 1]  =  0.0

How can I make x “forget” the 1,1 entry?

Found it: dropzeros!.

1 Like