Skip to content

Commit 77edba7

Browse files
committed
move sparsarrays to stdlib
1 parent 16707ba commit 77edba7

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

+804
-769
lines changed

NEWS.md

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

865+
* Sparse array functionality has moved to the `SparseArrays` standard library ([#TBD]).
866+
865867
* `@printf` and `@sprintf` have been moved to the `Printf` standard library ([#23929],[#25056]).
866868

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

base/asyncmap.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,10 +262,10 @@ end
262262

263263
# TODO: Optimize for sparse arrays
264264
# 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
265+
# function asyncmap(f, s::AbstractSparseArray...; kwargs...)
266+
# sa = map(Array, s)
267+
# return sparse(asyncmap(f, sa...; kwargs...))
268+
# end
269269

270270
mutable struct AsyncCollector
271271
f

base/deprecated.jl

Lines changed: 340 additions & 339 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))
@@ -494,7 +495,8 @@ Array(M::Tridiagonal) = Matrix(M)
494495
# On the other hand, similar(M, [neweltype,] shape...) should yield a sparse matrix.
495496
# The first method below effects the former, and the second the latter.
496497
similar(M::Tridiagonal, ::Type{T}) where {T} = Tridiagonal(similar(M.dl, T), similar(M.d, T), similar(M.du, T))
497-
similar(M::Tridiagonal, ::Type{T}, dims::Union{Dims{1},Dims{2}}) where {T} = spzeros(T, dims...)
498+
# The method below is moved to SparseArrays for now
499+
# similar(M::Tridiagonal, ::Type{T}, dims::Union{Dims{1},Dims{2}}) where {T} = spzeros(T, dims...)
498500

499501
# Operations on Tridiagonal matrices
500502
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: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,8 @@ include("libgit2/libgit2.jl")
428428
include("pkg/pkg.jl")
429429

430430
# sparse matrices, vectors, and sparse linear algebra
431-
include("sparse/sparse.jl")
432-
using .SparseArrays
431+
# include("sparse/sparse.jl")
432+
# using .SparseArrays
433433

434434
include("asyncmap.jl")
435435

@@ -499,6 +499,7 @@ Base.require(:IterativeEigensolvers)
499499
Base.require(:Mmap)
500500
Base.require(:Profile)
501501
Base.require(:SharedArrays)
502+
Base.require(:SparseArrays)
502503
Base.require(:SuiteSparse)
503504
Base.require(:Test)
504505
Base.require(:Unicode)

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,

0 commit comments

Comments
 (0)