move SparseArrays to stdlib#25249
Conversation
67dc16a to
17f8a9a
Compare
6c63ce9 to
d4fa4c5
Compare
|
Resurrect once #25364 clears, and then on to |
d4fa4c5 to
b32e398
Compare
|
Down to one: |
b32e398 to
77edba7
Compare
10763d5 to
6acf733
Compare
|
11e778b to
7d3e87c
Compare
|
|
||
| # TODO: Optimize for sparse arrays | ||
| # For now process as regular arrays and convert back | ||
| function asyncmap(f, s::AbstractSparseArray...; kwargs...) |
There was a problem hiding this comment.
I deprecated this in stdlib/SparseArrays/src/deprecated.jl since it is better to be transparent to the user that we don't have an optimized method for this anyway.
| @deprecate_moved droptol! "SparseArrays" false true | ||
| ## deprecated functions that are moved to stdlib/SparseArrays/src/deprecated.jl | ||
| @deprecate_moved spones "SparseArrays" true true | ||
| @deprecate_moved speye "SparseArrays" true true |
There was a problem hiding this comment.
Calling spones and speye now will result in users first getting redirected to SparseArrays, and then get a message that those methods are deprecated. But perhaps no big deal.
| end | ||
|
|
||
| # PR #22703 | ||
| import .LinAlg: Bidiagonal |
There was a problem hiding this comment.
Had to add this (and similarly below) to be able to build the sysimg, otherwise I get
LoadError("sysimg.jl", 461, LoadError("deprecated.jl", 507, TypeError(:Union, "parameter", Type, Bidiagonal)))
I wonder why those are not needed to compile master?
| if any(ifail .!= 0) | ||
| # TODO: better error message / type | ||
| error("failed to converge eigenvectors:\n$(nonzeros(ifail))") | ||
| error("failed to converge eigenvectors:\n$(find(x->x != 0, ifail))") |
There was a problem hiding this comment.
There is no nonzeros method for Vector on master, but with this excision we get
WARNING: importing deprecated binding Base.nonzeros into LAPACK.
here, so updated.
| SparseVector(length(x), copy(nonzeroinds(x)), copy(nonzeros(x))) | ||
|
|
||
| function reinterpret(::Type{T}, x::AbstractSparseVector{Tv}) where {T,Tv} | ||
| function Base.reinterpret(::Type{T}, x::AbstractSparseVector{Tv}) where {T,Tv} |
There was a problem hiding this comment.
I think this can be deleted.
| end | ||
|
|
||
| # findmin/findmax/minumum/maximum | ||
| @testset "findmin/findmax/minumum/maximum" begin |
There was a problem hiding this comment.
This just adds a testset to fix:
Deprecated syntax `implicit assignment to global variable `A``
| pop!(need_to_handle_undef_sparam, which(Base.SparseArrays._absspvec_vcat, (AbstractSparseArray{Tv, Ti, 1} where {Tv, Ti},))) | ||
| pop!(need_to_handle_undef_sparam, which(Base.SparseArrays._absspvec_hcat, (AbstractSparseArray{Tv, Ti, 1} where {Tv, Ti},))) | ||
| pop!(need_to_handle_undef_sparam, which(Base.cat, (Any, Base.SparseArrays._TypedDenseConcatGroup{T} where T))) | ||
| # pop!(need_to_handle_undef_sparam, which(SparseArrays._absspvec_vcat, (AbstractSparseArray{Tv, Ti, 1} where {Tv, Ti},))) |
There was a problem hiding this comment.
I don't know what this test does, but it passes with those two lines removed :)
|
This is no longer WIP, all tests, and doc building, passed for me locally, so feel free to review! |
| "If preserving element type `T` is not necessary, consider the shorter ", | ||
| "`sparse(I, size(S)...)` or `SparseMatrixCSC(I, size(S))` (with default ", | ||
| "`eltype(I)` of `Bool`)."), :speye) | ||
| return SparseMatrixCSC{T}(I, m, n) |
There was a problem hiding this comment.
SparseMatrixCSC{T}(I, m, n) -> SparseMatrixCSC{T}(I, size(S)...)
7d3e87c to
b4ff1bf
Compare
|
This looks good to me. Great work. |
492514d to
9c218a1
Compare
| * The functions `eigs` and `svds` have been moved to the `IterativeEigensolvers` standard | ||
| library module ([#24714]). | ||
|
|
||
| * Sparse array functionality has moved to the `SparseArrays` standard library ([#25249]). |
There was a problem hiding this comment.
Perhaps "has moved to the SparseArrays (package|module) in the standard library", "has moved to the SparseArrays standard library (package|module)", or "has moved to SparseArrays in the standard library"?
| ## functions that were re-exported from Base | ||
| @deprecate_moved nonzeros "SparseArrays" true true | ||
| @deprecate_moved permute "SparseArrays" true true | ||
| @deprecate_moved blkdiag "SparseArrays" true true |
There was a problem hiding this comment.
Tangentially, adding the oc to blockdiag might be nice...
| @deprecate_moved rowvals "SparseArrays" true true | ||
| @deprecate_moved nzrange "SparseArrays" true true | ||
| @deprecate_moved nnz "SparseArrays" true true | ||
| ## functions that where exported from Base.SparseArrays but not from Base |
Sacha0
left a comment
There was a problem hiding this comment.
Absolutely superlative! Thanks so much for your persistence and patience in seeing this work through! :)
9c218a1 to
04b3569
Compare
|
(The AV i686 failure seems unrelated. FreeBSD timed out without apparent issue prior.) |
|
Assuming CI continues to approve and absent objections or requests for time, I plan to merge these changes tomorrow midday PT or later. Best! |
|
Thanks so much for taking this on @fredrikekre! You're a true hero! |
|
When running |
|
What happens when you run |
|
|
This works! But indeed, running the |
|
Yeah, I think @fredrikekre identified the issue then. Not sure what the best way to solve it is. Probably change the show tests to look if the module is loaded in Main. |
|
Perhaps opening a dedicated issue would be worthwhile? Being able to copy-paste and/or include test files in REPL sessions is useful. Best! :) |
|
In the "test/offsetarray.jl", there is |

Work in progress, but at least I got this locally:
so its not too bad!
TODOs:
base/deprecated.jltostdlib/SparseArrays/src/deprecated.jl