Skip to content

Commit

Permalink
remove csparse functions
Browse files Browse the repository at this point in the history
The functions and tests for these function have been moved to the
package SuiteSparse.jl in the JuliaSparse organization.
  • Loading branch information
KristofferC committed Apr 27, 2016
1 parent d341677 commit 3fa0e3a
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 208 deletions.
1 change: 0 additions & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ their own licenses:
The following components of Julia's standard library have separate licenses:

- base/fftw.jl (see [FFTW](http://fftw.org/doc/License-and-Copyright.html))
- base/sparse/csparse.jl (LGPL-2.1+)
- base/linalg/umfpack.jl (see [SUITESPARSE](http://faculty.cse.tamu.edu/davis/suitesparse.html))
- base/linalg/cholmod.jl (see [SUITESPARSE](http://faculty.cse.tamu.edu/davis/suitesparse.html))

Expand Down
34 changes: 33 additions & 1 deletion base/sparse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export AbstractSparseArray, AbstractSparseMatrix, AbstractSparseVector,
include("sparse/abstractsparse.jl")
include("sparse/sparsematrix.jl")
include("sparse/sparsevector.jl")
include("sparse/csparse.jl")

include("sparse/linalg.jl")
if Base.USE_GPL_LIBS
Expand All @@ -45,4 +44,37 @@ if Base.USE_GPL_LIBS
include("sparse/spqr.jl")
end

# point users to SuiteSparse
const SUITESPARSE_END_ERR_SRING = string(" has been moved to the package SuiteSparse.jl.\n",
"Run Pkg.add(\"SuiteSparse\") to install SuiteSparse on Julia v0.5-")

"""
etree(A[, post])
Compute the elimination tree of a symmetric sparse matrix `A` from `triu(A)`
and, optionally, its post-ordering permutation.
Note: This function has been moved to the SuiteSparse.jl package.
"""
etree{Tv,Ti}(A::SparseMatrixCSC{Tv,Ti}, postorder::Bool) =
error("etree(A[, post])", SUITESPARSE_END_ERR_SRING)
etree(A::SparseMatrixCSC) = etree(A, false)

ereach{Tv,Ti}(A::SparseMatrixCSC{Tv,Ti}, k::Integer, parent::Vector{Ti}) =
error("ereach(A, k, parent)", SUITESPARSE_END_ERR_SRING)

csc_permute{Tv,Ti}(A::SparseMatrixCSC{Tv,Ti}, pinv::Vector{Ti}, q::Vector{Ti})=
error("csc_permute(A, pinv, q)", SUITESPARSE_END_ERR_SRING)

"""
symperm(A, p)
Return the symmetric permutation of `A`, which is `A[p,p]`. `A` should be
symmetric, sparse, and only contain nonzeros in the upper triangular part of the
matrix is stored. This algorithm ignores the lower triangular part of the
matrix. Only the upper triangular part of the result is returned.
Note: This function has been moved to the SuiteSparse.jl package.
"""
symperm{Tv,Ti}(A::SparseMatrixCSC{Tv,Ti}, pinv::Vector{Ti}) =
error("symperm(A, pinv)", SuiteSparse_END_ERR_SRING)

end
178 changes: 0 additions & 178 deletions base/sparse/csparse.jl

This file was deleted.

1 change: 0 additions & 1 deletion contrib/add_license_to_files.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ const skipfiles = [
# files to check - already copyright
# see: https://github.com/JuliaLang/julia/pull/11073#issuecomment-98099389
"../base/special/trig.jl",
"../base/sparse/csparse.jl",
"../base/linalg/givens.jl",
#
"../src/abi_llvm.cpp",
Expand Down
6 changes: 5 additions & 1 deletion doc/stdlib/arrays.rst
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ Constructors

.. Docstring generated from Julia source
Create an array with the same data as the given array, but with different dimensions. An implementation for a particular type of array may choose whether the data is copied or shared.
Create an array with the same data as the given array, but with different dimensions.

.. function:: similar(array, [element_type=eltype(array)], [dims=size(array)])

Expand Down Expand Up @@ -971,12 +971,16 @@ dense counterparts. The following functions are specific to sparse arrays.
Compute the elimination tree of a symmetric sparse matrix ``A`` from ``triu(A)`` and, optionally, its post-ordering permutation.

Note: This function has been moved to the CSparse.jl package.

.. function:: symperm(A, p)

.. Docstring generated from Julia source
Return the symmetric permutation of ``A``\ , which is ``A[p,p]``\ . ``A`` should be symmetric, sparse, and only contain nonzeros in the upper triangular part of the matrix is stored. This algorithm ignores the lower triangular part of the matrix. Only the upper triangular part of the result is returned.

Note: This function has been moved to the CSparse.jl package.

.. function:: nonzeros(A)

.. Docstring generated from Julia source
Expand Down
28 changes: 2 additions & 26 deletions test/sparsedir/sparse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -343,20 +343,6 @@ end
@test full(spdiagm((ones(2), ones(2)), (0, -1), 3, 3)) ==
[1.0 0.0 0.0; 1.0 1.0 0.0; 0.0 1.0 0.0]

# elimination tree
## upper triangle of the pattern test matrix from Figure 4.2 of
## "Direct Methods for Sparse Linear Systems" by Tim Davis, SIAM, 2006
rowval = Int32[1,2,2,3,4,5,1,4,6,1,7,2,5,8,6,9,3,4,6,8,10,3,5,7,8,10,11]
colval = Int32[1,2,3,3,4,5,6,6,6,7,7,8,8,8,9,9,10,10,10,10,10,11,11,11,11,11,11]
A = sparse(rowval, colval, ones(length(rowval)))
p = etree(A)
P,post = etree(A, true)
@test P == p
@test P == Int32[6,3,8,6,8,7,9,10,10,11,0]
@test post == Int32[2,3,5,8,1,4,6,7,9,10,11]
@test isperm(post)


# issue #4986, reinterpret
sfe22 = speye(Float64, 2)
mfe22 = eye(Float64, 2)
Expand Down Expand Up @@ -1019,13 +1005,9 @@ A = sparse(tril(rand(5,5)))
@test istril(A)
@test !istril(sparse(ones(5,5)))

# symperm
srand(1234321)
A = triu(sprand(10,10,0.2)) # symperm operates on upper triangle
perm = randperm(10)
@test symperm(A,perm).colptr == [1,1,2,4,5,5,6,8,8,9,10]

# droptol
srand(1234321)
A = triu(sprand(10,10,0.2))
@test Base.droptol!(A,0.01).colptr == [1,1,1,2,2,3,4,6,6,7,9]
@test isequal(Base.droptol!(sparse([1], [1], [1]), 1), SparseMatrixCSC(1,1,Int[1,1],Int[],Int[]))

Expand Down Expand Up @@ -1224,12 +1206,6 @@ if Base.USE_GPL_LIBS
end
@test_throws DimensionMismatch Base.SparseArrays.normestinv(sprand(3,5,.9))

# csc_permute
A = sprand(10,10,0.2)
p = randperm(10)
q = randperm(10)
@test Base.SparseArrays.csc_permute(A, invperm(p), q) == full(A)[p, q]

# issue #13008
@test_throws ArgumentError sparse(collect(1:100), collect(1:100), fill(5,100), 5, 5)
@test_throws ArgumentError sparse(Int[], collect(1:5), collect(1:5))
Expand Down

0 comments on commit 3fa0e3a

Please sign in to comment.