I’m not sure if this is a bug or a feature but copying a sparse vector into a column of a sparse matrix keeps (or rather adds) some of the zeros explicitly:
julia> using SparseArrays
julia> m=sparse([[0,1,2,0,0] [0,3,0,4,0]])
5×2 SparseMatrixCSC{Int64,Int64} with 4 stored entries:
[2, 1] = 1
[3, 1] = 2
[2, 2] = 3
[4, 2] = 4
julia> v=sparse([1,2,0,0,0])
5-element SparseVector{Int64,Int64} with 2 stored entries:
[1] = 1
[2] = 2
julia> m[:,1]=v
5-element SparseVector{Int64,Int64} with 2 stored entries:
[1] = 1
[2] = 2
julia> m
5×2 SparseMatrixCSC{Int64,Int64} with 5 stored entries:
[1, 1] = 1
[2, 1] = 2
[3, 1] = 0 <-----
[2, 2] = 3
[4, 2] = 4
julia> findnz(m)
([1, 2, 3, 2, 4], [1, 1, 1, 2, 2], [1, 2, 0, 3, 4])
I understand explicitly allocating a particular entry of the matrix to 0 does just that, but here the right hand side is a sparse vector, so I don’t get why this is happening.