-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Move findnz to SparseArrays module #25641
Conversation
deleteat!(V, (count+1):numnz) | ||
I[count] = nzind[i] | ||
V[count] = nzval[i] | ||
count += 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for summing count
anymore, either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed. I copied the SparseMatrix
method too litterally.
0335175 changed the SparseMatrix method to also return stored zeros, but it forgot to change the SparseVector method.
Its definition (return stored entries) only makes sense in the context of sparse arrays.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm! Thanks @nalimilan! :)
Tangentially, the more I consider this function, the more convinced I become that Stefan's "kill it with fire" quip was spot on. What particularly bothers me is the difference in this function's behavior between dense and sparse arrays; in other words, I am not certain I could write a generally valid docstring for this function as it stands. Best! :) |
Yes, I was actually going to say something similar. It would make sense to deprecate the non-sparse methods in favor of |
It looks like the doc string for |
Its definition (return stored entries) only makes sense in the context of sparse arrays. Closes #24910. Part of #10593.
The first commit should be kept separate, it fixes an inconsistency spotted at #24910 (comment).