-
-
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
Remove methods for creating "sparse vectors" #11323
Comments
It would likely be pretty disruptive to completely remove the ability to do
Given that there now exists a SparseVectors.jl package there |
If it is considered to be too disruptive, we can consider deprecating them, and pointing people who need those functions to the SparseVectors package. |
Deprecation without a direct in-base replacement is an interesting idea. Let's try it. And looking more closely I see you have a |
What about the following way: In Base, we have function getindex(A::SparseMatrixCSC, ::Colon, i::Real)
depwarn("A[:, i] for sparse matrix is deprecated in Base. Please import the SparseVectors package for a corrected implementation")
# still does what it is doing now
end In SparseVectors package, we have Base.getindex(A::SparseMatrixCSC, ::Colon, i::Integer) = # correct implementation that returns a SparseVector So if SparseVectors is imported, it just works with the corrected behavior (without warning). Otherwise, it still works, but with the current behavior, and the caller will see a warning. |
Clever. Related to #10154, but it sounds like it could work. |
It sounds weird that you wouldn't be able to index a sparse matrix without installing and loading an additional package. This also means that the behavior of sparse matrix indexing could depend on which one of competing sparse vector packages is loaded? It would make more sense to me to link the matrix and vector sparse formats in a common package/module, since when indexing the former you get the latter. Alternative implementations would also provide both in order to offer a predictable indexing behaviour -- which is probably also more efficient since a specific sparse matrix format might be associated with a specific efficient structure for sparse vectors. So in the terms of #11324 this is a vote for (B). |
Agreed, this now looks to me like a convoluted and fragile way to avoid fixing something that we know is broken. |
I really want to just fix it, and change the existing broken behaviour ASAP. |
Let's close this option then. @lindahua can you work on a PR to bring in the vector type and basic arithmetic functionality, and fix the broken vector/getindex methods mentioned here? I think it's best to leave the advanced views and unsafe references stuff out in the package for now. |
Yes, leave views and unsafe references in the package - perhaps can become part of Arrayviews.jl or NumericExtensions.jl. |
Or stay where it is, since the package will still need to exist to provide support for 0.3 |
Good point. |
Currently, we have a bunch of methods that claim to construct sparse vectors but instead produce a sparse matrix (of type
SparseMatrixCSC
).Here is a (probably incomplete) list of such functions:
Related to #8718. At least, we should deprecate them.
The text was updated successfully, but these errors were encountered: