Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

findnz/nnz mismatch: findnz returns actual, not structural zeros #23121

Closed
StefanKarpinski opened this issue Aug 3, 2017 · 1 comment
Closed
Assignees
Labels
domain:arrays:sparse Sparse arrays domain:linear algebra Linear algebra stdlib Julia's standard library
Milestone

Comments

@StefanKarpinski
Copy link
Sponsor Member

julia> S = sparse([1], [1], [0])
1×1 SparseMatrixCSC{Int64,Int64} with 1 stored entry:
  [1, 1]  =  0

julia> nnz(S)
1

julia> findnz(S)
(Int64[], Int64[], Int64[])

julia> findn(S)
(Int64[], Int64[])

Given their similar naming, it seems like these should match. Given the decision in #23005 that we're replacing countnz(S) with count(!iszero, S) it might make sense to find actual non-zeros with a more generic function and a !iszero predicate.

@KristofferC
Copy link
Sponsor Member

#24724

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:arrays:sparse Sparse arrays domain:linear algebra Linear algebra stdlib Julia's standard library
Projects
None yet
Development

No branches or pull requests

3 participants