Skip to content

Commit 6acf733

Browse files
committed
move SparseArrays to stdlib [ci skip] [bsd skip]
1 parent 9b5eed2 commit 6acf733

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+623
-568
lines changed

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -872,6 +872,8 @@ Deprecated or removed
872872
* The functions `eigs` and `svds` have been moved to the `IterativeEigensolvers` standard
873873
library module ([#24714]).
874874

875+
* Sparse array functionality has moved to the `SparseArrays` standard library ([#25249]).
876+
875877
* `@printf` and `@sprintf` have been moved to the `Printf` standard library ([#23929],[#25056]).
876878

877879
* `isnumber` has been deprecated in favor of `isnumeric`, `is_assigned_char`

base/asyncmap.jl

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -260,13 +260,6 @@ function asyncmap(f, b::BitArray; kwargs...)
260260
return b2
261261
end
262262

263-
# TODO: Optimize for sparse arrays
264-
# For now process as regular arrays and convert back
265-
function asyncmap(f, s::AbstractSparseArray...; kwargs...)
266-
sa = map(Array, s)
267-
return sparse(asyncmap(f, sa...; kwargs...))
268-
end
269-
270263
mutable struct AsyncCollector
271264
f
272265
results

base/deprecated.jl

Lines changed: 31 additions & 217 deletions
Large diffs are not rendered by default.

base/exports.jl

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -434,15 +434,13 @@ export
434434
minimum,
435435
minmax,
436436
ndims,
437-
nonzeros,
438437
ones,
439438
parent,
440439
parentindices,
441440
partialsort,
442441
partialsort!,
443442
partialsortperm,
444443
partialsortperm!,
445-
permute,
446444
permute!,
447445
permutedims,
448446
permutedims!,
@@ -513,7 +511,6 @@ export
513511
# linear algebra
514512
bkfact!,
515513
bkfact,
516-
blkdiag,
517514
chol,
518515
cholfact!,
519516
cholfact,
@@ -594,10 +591,6 @@ export
594591
,
595592
×,
596593

597-
# sparse
598-
dropzeros,
599-
dropzeros!,
600-
601594
# bitarrays
602595
falses,
603596
flipbits!,
@@ -1183,22 +1176,4 @@ export
11831176
@goto,
11841177
@view,
11851178
@views,
1186-
@static,
1187-
1188-
# SparseArrays module re-exports
1189-
SparseArrays,
1190-
AbstractSparseArray,
1191-
AbstractSparseMatrix,
1192-
AbstractSparseVector,
1193-
SparseMatrixCSC,
1194-
SparseVector,
1195-
issparse,
1196-
sparse,
1197-
sparsevec,
1198-
spdiagm,
1199-
sprand,
1200-
sprandn,
1201-
spzeros,
1202-
rowvals,
1203-
nzrange,
1204-
nnz
1179+
@static

base/linalg/bidiag.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,8 @@ broadcast(::typeof(big), B::Bidiagonal) = Bidiagonal(big.(B.dv), big.(B.ev), B.u
178178
# On the other hand, similar(B, [neweltype,] shape...) should yield a sparse matrix.
179179
# The first method below effects the former, and the second the latter.
180180
similar(B::Bidiagonal, ::Type{T}) where {T} = Bidiagonal(similar(B.dv, T), similar(B.ev, T), B.uplo)
181-
similar(B::Bidiagonal, ::Type{T}, dims::Union{Dims{1},Dims{2}}) where {T} = spzeros(T, dims...)
181+
# The method below is moved to SparseArrays for now
182+
# similar(B::Bidiagonal, ::Type{T}, dims::Union{Dims{1},Dims{2}}) where {T} = spzeros(T, dims...)
182183

183184

184185
###################

base/linalg/dense.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,6 @@ Vector `kv.second` will be placed on the `kv.first` diagonal.
303303
versions with fast arithmetic, see [`Diagonal`](@ref), [`Bidiagonal`](@ref)
304304
[`Tridiagonal`](@ref) and [`SymTridiagonal`](@ref).
305305
306-
See also: [`spdiagm`](@ref)
307-
308306
# Examples
309307
```jldoctest
310308
julia> diagm(1 => [1,2,3])

base/linalg/diagonal.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ Array(D::Diagonal) = Matrix(D)
5959
# On the other hand, similar(D, [neweltype,] shape...) should yield a sparse matrix.
6060
# The first method below effects the former, and the second the latter.
6161
similar(D::Diagonal, ::Type{T}) where {T} = Diagonal(similar(D.diag, T))
62-
similar(D::Diagonal, ::Type{T}, dims::Union{Dims{1},Dims{2}}) where {T} = spzeros(T, dims...)
62+
# The method below is moved to SparseArrays for now
63+
# similar(D::Diagonal, ::Type{T}, dims::Union{Dims{1},Dims{2}}) where {T} = spzeros(T, dims...)
6364

6465
copyto!(D1::Diagonal, D2::Diagonal) = (copyto!(D1.diag, D2.diag); D1)
6566

base/linalg/tridiag.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ end
111111
# On the other hand, similar(S, [neweltype,] shape...) should yield a sparse matrix.
112112
# The first method below effects the former, and the second the latter.
113113
similar(S::SymTridiagonal, ::Type{T}) where {T} = SymTridiagonal(similar(S.dv, T), similar(S.ev, T))
114-
similar(S::SymTridiagonal, ::Type{T}, dims::Union{Dims{1},Dims{2}}) where {T} = spzeros(T, dims...)
114+
# The method below is moved to SparseArrays for now
115+
# similar(S::SymTridiagonal, ::Type{T}, dims::Union{Dims{1},Dims{2}}) where {T} = spzeros(T, dims...)
115116

116117
#Elementary operations
117118
broadcast(::typeof(abs), M::SymTridiagonal) = SymTridiagonal(abs.(M.dv), abs.(M.ev))
@@ -497,7 +498,8 @@ Array(M::Tridiagonal) = Matrix(M)
497498
# On the other hand, similar(M, [neweltype,] shape...) should yield a sparse matrix.
498499
# The first method below effects the former, and the second the latter.
499500
similar(M::Tridiagonal, ::Type{T}) where {T} = Tridiagonal(similar(M.dl, T), similar(M.d, T), similar(M.du, T))
500-
similar(M::Tridiagonal, ::Type{T}, dims::Union{Dims{1},Dims{2}}) where {T} = spzeros(T, dims...)
501+
# The method below is moved to SparseArrays for now
502+
# similar(M::Tridiagonal, ::Type{T}, dims::Union{Dims{1},Dims{2}}) where {T} = spzeros(T, dims...)
501503

502504
# Operations on Tridiagonal matrices
503505
copyto!(dest::Tridiagonal, src::Tridiagonal) = (copyto!(dest.dl, src.dl); copyto!(dest.d, src.d); copyto!(dest.du, src.du); dest)

base/sysimg.jl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -427,10 +427,6 @@ include("libgit2/libgit2.jl")
427427
# package manager
428428
include("pkg/pkg.jl")
429429

430-
# sparse matrices, vectors, and sparse linear algebra
431-
include("sparse/sparse.jl")
432-
using .SparseArrays
433-
434430
include("asyncmap.jl")
435431

436432
# worker threads
@@ -499,6 +495,7 @@ Base.require(:IterativeEigensolvers)
499495
Base.require(:Mmap)
500496
Base.require(:Profile)
501497
Base.require(:SharedArrays)
498+
Base.require(:SparseArrays)
502499
Base.require(:SuiteSparse)
503500
Base.require(:Test)
504501
Base.require(:Unicode)
@@ -512,6 +509,7 @@ Base.require(:Future)
512509
@deprecate_binding Profile root_module(:Profile) true ", run `using Profile` instead"
513510
@deprecate_binding Dates root_module(:Dates) true ", run `using Dates` instead"
514511
@deprecate_binding Distributed root_module(:Distributed) true ", run `using Distributed` instead"
512+
@deprecate_binding SparseArrays root_module(:SparseArrays) true ", run `using SparseArrays` instead"
515513
end
516514

517515
empty!(LOAD_PATH)

doc/make.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ if Sys.iswindows()
3030
cp_q("../stdlib/FileWatching/docs/src/index.md", "src/stdlib/filewatching.md")
3131
cp_q("../stdlib/CRC32c/docs/src/index.md", "src/stdlib/crc32c.md")
3232
cp_q("../stdlib/Dates/docs/src/index.md", "src/stdlib/dates.md")
33+
cp_q("../stdlib/SparseArrays/docs/src/index.md", "src/stdlib/sparsearrays.md")
3334
cp_q("../stdlib/IterativeEigensolvers/docs/src/index.md", "src/stdlib/iterativeeigensolvers.md")
3435
cp_q("../stdlib/Unicode/docs/src/index.md", "src/stdlib/unicode.md")
3536
cp_q("../stdlib/Distributed/docs/src/index.md", "src/stdlib/distributed.md")
@@ -44,6 +45,7 @@ else
4445
symlink_q("../../../stdlib/FileWatching/docs/src/index.md", "src/stdlib/filewatching.md")
4546
symlink_q("../../../stdlib/CRC32c/docs/src/index.md", "src/stdlib/crc32c.md")
4647
symlink_q("../../../stdlib/Dates/docs/src/index.md", "src/stdlib/dates.md")
48+
symlink_q("../../../stdlib/SparseArrays/docs/src/index.md", "src/stdlib/sparsearrays.md")
4749
symlink_q("../../../stdlib/IterativeEigensolvers/docs/src/index.md", "src/stdlib/iterativeeigensolvers.md")
4850
symlink_q("../../../stdlib/Unicode/docs/src/index.md", "src/stdlib/unicode.md")
4951
symlink_q("../../../stdlib/Distributed/docs/src/index.md", "src/stdlib/distributed.md")
@@ -125,6 +127,7 @@ const PAGES = [
125127
"stdlib/sharedarrays.md",
126128
"stdlib/filewatching.md",
127129
"stdlib/crc32c.md",
130+
"stdlib/sparsearrays.md",
128131
"stdlib/iterativeeigensolvers.md",
129132
"stdlib/unicode.md",
130133
"stdlib/printf.md",
@@ -163,12 +166,13 @@ const PAGES = [
163166
]
164167

165168
using DelimitedFiles, Test, Mmap, SharedArrays, Profile, Base64, FileWatching, CRC32c,
166-
Dates, IterativeEigensolvers, Unicode, Distributed, Printf
169+
Dates, SparseArrays, IterativeEigensolvers, Unicode, Distributed, Printf
167170

168171
makedocs(
169172
build = joinpath(pwd(), "_build/html/en"),
170173
modules = [Base, Core, BuildSysImg, DelimitedFiles, Test, Mmap, SharedArrays, Profile,
171-
Base64, FileWatching, Dates, IterativeEigensolvers, Unicode, Distributed, Printf],
174+
Base64, FileWatching, Dates, SparseArrays, IterativeEigensolvers, Unicode,
175+
Distributed, Printf],
172176
clean = false,
173177
doctest = "doctest" in ARGS,
174178
linkcheck = "linkcheck" in ARGS,

doc/src/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
* [Memory-mapped I/O](@ref)
7575
* [Base64](@ref)
7676
* [File Events](@ref lib-filewatching)
77+
* [Sparse Arrays](@ref)
7778
* [Iterative Eigensolvers](@ref lib-itereigen)
7879
* [Unicode](@ref)
7980
* [Printf](@ref)

0 commit comments

Comments
 (0)