Skip to content

Commit

Permalink
move SparseArrays to stdlib [ci skip] [bds skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikekre committed Dec 29, 2017
1 parent 4d166fa commit 17f8a9a
Show file tree
Hide file tree
Showing 51 changed files with 798 additions and 770 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,8 @@ Deprecated or removed
* 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 ([#TBD]).

* `@printf` and `@sprintf` have been moved to the `Printf` standard library ([#23929],[#25056]).

* `isnumber` has been deprecated in favor of `isnumeric`, `is_assigned_char`
Expand Down
8 changes: 4 additions & 4 deletions base/asyncmap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,10 @@ end

# TODO: Optimize for sparse arrays
# For now process as regular arrays and convert back
function asyncmap(f, s::AbstractSparseArray...; kwargs...)
sa = map(Array, s)
return sparse(asyncmap(f, sa...; kwargs...))
end
# function asyncmap(f, s::AbstractSparseArray...; kwargs...)
# sa = map(Array, s)
# return sparse(asyncmap(f, sa...; kwargs...))
# end

mutable struct AsyncCollector
f
Expand Down
681 changes: 340 additions & 341 deletions base/deprecated.jl

Large diffs are not rendered by default.

27 changes: 1 addition & 26 deletions base/exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -446,15 +446,13 @@ export
minimum,
minmax,
ndims,
nonzeros,
ones,
parent,
parentindices,
partialsort,
partialsort!,
partialsortperm,
partialsortperm!,
permute,
permute!,
permutedims,
permutedims!,
Expand Down Expand Up @@ -504,7 +502,6 @@ export
# linear algebra
bkfact!,
bkfact,
blkdiag,
chol,
cholfact!,
cholfact,
Expand Down Expand Up @@ -585,10 +582,6 @@ export
,
×,

# sparse
dropzeros,
dropzeros!,

# bitarrays
falses,
flipbits!,
Expand Down Expand Up @@ -1194,22 +1187,4 @@ export
@goto,
@view,
@views,
@static,

# SparseArrays module re-exports
SparseArrays,
AbstractSparseArray,
AbstractSparseMatrix,
AbstractSparseVector,
SparseMatrixCSC,
SparseVector,
issparse,
sparse,
sparsevec,
spdiagm,
sprand,
sprandn,
spzeros,
rowvals,
nzrange,
nnz
@static
3 changes: 2 additions & 1 deletion base/linalg/bidiag.jl
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ broadcast(::typeof(big), B::Bidiagonal) = Bidiagonal(big.(B.dv), big.(B.ev), B.u
# On the other hand, similar(B, [neweltype,] shape...) should yield a sparse matrix.
# The first method below effects the former, and the second the latter.
similar(B::Bidiagonal, ::Type{T}) where {T} = Bidiagonal(similar(B.dv, T), similar(B.ev, T), B.uplo)
similar(B::Bidiagonal, ::Type{T}, dims::Union{Dims{1},Dims{2}}) where {T} = spzeros(T, dims...)
# The method below is moved to SparseArrays for now
# similar(B::Bidiagonal, ::Type{T}, dims::Union{Dims{1},Dims{2}}) where {T} = spzeros(T, dims...)


###################
Expand Down
2 changes: 0 additions & 2 deletions base/linalg/dense.jl
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,6 @@ Vector `kv.second` will be placed on the `kv.first` diagonal.
versions with fast arithmetic, see [`Diagonal`](@ref), [`Bidiagonal`](@ref)
[`Tridiagonal`](@ref) and [`SymTridiagonal`](@ref).
See also: [`spdiagm`](@ref)
# Examples
```jldoctest
julia> diagm(1 => [1,2,3])
Expand Down
3 changes: 2 additions & 1 deletion base/linalg/diagonal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ Array(D::Diagonal) = Matrix(D)
# On the other hand, similar(D, [neweltype,] shape...) should yield a sparse matrix.
# The first method below effects the former, and the second the latter.
similar(D::Diagonal, ::Type{T}) where {T} = Diagonal(similar(D.diag, T))
similar(D::Diagonal, ::Type{T}, dims::Union{Dims{1},Dims{2}}) where {T} = spzeros(T, dims...)
# The method below is moved to SparseArrays for now
# similar(D::Diagonal, ::Type{T}, dims::Union{Dims{1},Dims{2}}) where {T} = spzeros(T, dims...)

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

Expand Down
6 changes: 4 additions & 2 deletions base/linalg/tridiag.jl
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ end
# On the other hand, similar(S, [neweltype,] shape...) should yield a sparse matrix.
# The first method below effects the former, and the second the latter.
similar(S::SymTridiagonal, ::Type{T}) where {T} = SymTridiagonal(similar(S.dv, T), similar(S.ev, T))
similar(S::SymTridiagonal, ::Type{T}, dims::Union{Dims{1},Dims{2}}) where {T} = spzeros(T, dims...)
# The method below is moved to SparseArrays for now
# similar(S::SymTridiagonal, ::Type{T}, dims::Union{Dims{1},Dims{2}}) where {T} = spzeros(T, dims...)

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

# Operations on Tridiagonal matrices
copyto!(dest::Tridiagonal, src::Tridiagonal) = (copyto!(dest.dl, src.dl); copyto!(dest.d, src.d); copyto!(dest.du, src.du); dest)
Expand Down
4 changes: 2 additions & 2 deletions base/precompile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ precompile(Tuple{typeof(Base.LineEdit.commit_changes), Base.Terminals.TTYTermina
precompile(Tuple{typeof(Base.LineEdit.complete_line), Base.LineEdit.PromptState, Int64})
precompile(Tuple{typeof(Base.LineEdit.input_string_newlines_aftercursor), Base.LineEdit.PromptState})
precompile(Tuple{typeof(Base.LineEdit.complete_line), Base.REPL.REPLCompletionProvider, Base.LineEdit.PromptState})
precompile(Tuple{getfield(Base, Symbol("#kw##parse")), Array{Any, 1}, typeof(Base.parse), String})
# precompile(Tuple{getfield(Base, Symbol("#kw##parse")), Array{Any, 1}, typeof(Base.parse), String})
precompile(Tuple{typeof(Base.rsearch), String, Array{Char, 1}, Int64})
precompile(Tuple{getfield(Base.REPLCompletions, Symbol("#kw##find_start_brace")), Array{Any, 1}, typeof(Base.REPLCompletions.find_start_brace), String})
precompile(Tuple{typeof(Core.Inference.isbits), Tuple{Nothing, Nothing, Nothing}})
Expand Down Expand Up @@ -944,7 +944,7 @@ precompile(Tuple{typeof(Core.Inference.getindex), Tuple{DataType, Core.Inference
precompile(Tuple{getfield(Base.Markdown, Symbol("#kw##parse_inline_wrapper")), Array{Any, 1}, typeof(Base.Markdown.parse_inline_wrapper), Base.GenericIOBuffer{Array{UInt8, 1}}, String})
precompile(Tuple{typeof(Base.Markdown.startswith), Base.GenericIOBuffer{Array{UInt8, 1}}, String})
precompile(Tuple{typeof(Base.Markdown.blockinterp), Base.GenericIOBuffer{Array{UInt8, 1}}, Base.Markdown.MD})
precompile(Tuple{getfield(Base, Symbol("#kw##parse")), Array{Any, 1}, typeof(Base.parse), Base.GenericIOBuffer{Array{UInt8, 1}}})
# precompile(Tuple{getfield(Base, Symbol("#kw##parse")), Array{Any, 1}, typeof(Base.parse), Base.GenericIOBuffer{Array{UInt8, 1}}})
precompile(Tuple{typeof(Base.Markdown.interpinner), Base.GenericIOBuffer{Array{UInt8, 1}}, Bool})
precompile(Tuple{typeof(Base.Markdown.indentcode), Base.GenericIOBuffer{Array{UInt8, 1}}, Base.Markdown.MD})
precompile(Tuple{typeof(Base.Markdown.footnote), Base.GenericIOBuffer{Array{UInt8, 1}}, Base.Markdown.MD})
Expand Down
5 changes: 3 additions & 2 deletions base/sysimg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -427,8 +427,8 @@ include("libgit2/libgit2.jl")
include("pkg/pkg.jl")

# sparse matrices, vectors, and sparse linear algebra
include("sparse/sparse.jl")
using .SparseArrays
# include("sparse/sparse.jl")
# using .SparseArrays

include("asyncmap.jl")

Expand Down Expand Up @@ -498,6 +498,7 @@ Base.require(:IterativeEigensolvers)
Base.require(:Mmap)
Base.require(:Profile)
Base.require(:SharedArrays)
Base.require(:SparseArrays)
Base.require(:SuiteSparse)
Base.require(:Test)
Base.require(:Unicode)
Expand Down
8 changes: 6 additions & 2 deletions doc/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ if Sys.iswindows()
cp_q("../stdlib/FileWatching/docs/src/index.md", "src/stdlib/filewatching.md")
cp_q("../stdlib/CRC32c/docs/src/index.md", "src/stdlib/crc32c.md")
cp_q("../stdlib/Dates/docs/src/index.md", "src/stdlib/dates.md")
cp_q("../stdlib/SparseArrays/docs/src/index.md", "src/stdlib/sparsearrays.md")
cp_q("../stdlib/IterativeEigensolvers/docs/src/index.md", "src/stdlib/iterativeeigensolvers.md")
cp_q("../stdlib/Unicode/docs/src/index.md", "src/stdlib/unicode.md")
cp_q("../stdlib/Distributed/docs/src/index.md", "src/stdlib/distributed.md")
Expand All @@ -44,6 +45,7 @@ else
symlink_q("../../../stdlib/FileWatching/docs/src/index.md", "src/stdlib/filewatching.md")
symlink_q("../../../stdlib/CRC32c/docs/src/index.md", "src/stdlib/crc32c.md")
symlink_q("../../../stdlib/Dates/docs/src/index.md", "src/stdlib/dates.md")
symlink_q("../../../stdlib/SparseArrays/docs/src/index.md", "src/stdlib/sparsearrays.md")
symlink_q("../../../stdlib/IterativeEigensolvers/docs/src/index.md", "src/stdlib/iterativeeigensolvers.md")
symlink_q("../../../stdlib/Unicode/docs/src/index.md", "src/stdlib/unicode.md")
symlink_q("../../../stdlib/Distributed/docs/src/index.md", "src/stdlib/distributed.md")
Expand Down Expand Up @@ -125,6 +127,7 @@ const PAGES = [
"stdlib/sharedarrays.md",
"stdlib/filewatching.md",
"stdlib/crc32c.md",
"stdlib/sparsearrays.md",
"stdlib/iterativeeigensolvers.md",
"stdlib/unicode.md",
"stdlib/printf.md",
Expand Down Expand Up @@ -163,12 +166,13 @@ const PAGES = [
]

using DelimitedFiles, Test, Mmap, SharedArrays, Profile, Base64, FileWatching, CRC32c,
Dates, IterativeEigensolvers, Unicode, Distributed, Printf
Dates, SparseArrays, IterativeEigensolvers, Unicode, Distributed, Printf

makedocs(
build = joinpath(pwd(), "_build/html/en"),
modules = [Base, Core, BuildSysImg, DelimitedFiles, Test, Mmap, SharedArrays, Profile,
Base64, FileWatching, Dates, IterativeEigensolvers, Unicode, Distributed, Printf],
Base64, FileWatching, Dates, SparseArrays, IterativeEigensolvers, Unicode,
Distributed, Printf],
clean = false,
doctest = "doctest" in ARGS,
linkcheck = "linkcheck" in ARGS,
Expand Down
1 change: 1 addition & 0 deletions doc/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
* [Memory-mapped I/O](@ref)
* [Base64](@ref)
* [File Events](@ref lib-filewatching)
* [Sparse Arrays](@ref)
* [Iterative Eigensolvers](@ref lib-itereigen)
* [Unicode](@ref)
* [Printf](@ref)
Expand Down
Loading

0 comments on commit 17f8a9a

Please sign in to comment.