-
-
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
spones documentation is incorrect #22381
Comments
I agree that the documentation is not correct but I think both behaviors could be defended. Notice that we satisfy
Our sparse matrices are already different from Matlab's. In Julia, the user has to consider the possibility of stored zeros. However, the documentation should be precise about this. |
The existing behavior seems consistent with the long-term direction of evolution of sparse arrays' overall behavior (being concerned with stored entries rather than numerical zeros). Adjusting the documentation as you suggest strikes me as the best and simplest solution, perhaps augmented with a pointer to |
Here's my slightly nuanced take. I appreciate where you are coming from with the idea of stored entries That said, that's a bigger task. In terms of
So again, I think changing the name to |
The documentation for the spones function describes the Matlab behavior for this function, which replaces each non-zero entry by a value of 1.0. However, the implementation appears to use julia's notion of "stored entries" instead.
Expected behavior given the documentation
So note that there are two issues with the current documentation. First, the value is one(T) not 1.0. Second, the operation proceeds over the stored entries, not the non-zero stored entries.
Ideal handling.
spones
to do the same thing as Matlab's function. In which case, this would operate according to the documentation. (That is, it would satisfy the relationshipcountnz(spones(A)) == countnz(A)
)spsones
?Minimal handling.
I don't like the minimal handling because the semantics of Matlab's
spones
and Julia'sspones
are radically different in unexpected and bug-inducing fashions because I have no idea which Julia operations introduce new structural non-zeros. (Let's just say I spent a while working with the wrong distribution of random matrices.)The text was updated successfully, but these errors were encountered: