Closed
Description
I often find the following pattern useful for sparse matrices.
a = sprand(4, 4, 0.5)
b = [nnz(c) for c in eachcol(a)]
However, if I try the same thing with the findnz()
it appears that this method does not exist.
b = [findnz(c)[1] for c in eachcol(a)]
ERROR: MethodError: no method matching findnz(::SubArray{Float64, 1, SparseMatrixCSC{Float64, Int64}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, false})
Does adding this method make sense for a future version SparseArrays
?
Metadata
Metadata
Assignees
Labels
No labels