Skip to content

Commit

Permalink
Add tests for expandptr
Browse files Browse the repository at this point in the history
  • Loading branch information
kshyatt committed Sep 26, 2016
1 parent c71f205 commit 3815812
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/sparsedir/sparse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1276,6 +1276,13 @@ end
@test diagm(sparse(ones(1,5))) == speye(5)
@test diagm(sparse(ones(5,1))) == speye(5)

#expandptr
A = speye(5)
@test Base.SparseArrays.expandptr(A.colptr) == collect(1:5)
A[1,2] = 1
@test Base.SparseArrays.expandptr(A.colptr) == [1; 2; 2; 3; 4; 5]
@test_throws ArgumentError Base.SparseArrays.expandptr([2; 3])

# triu/tril
A = sprand(5,5,0.2)
AF = full(A)
Expand Down Expand Up @@ -1430,6 +1437,14 @@ Ai = ceil(Int,Ar*100)
@test norm(Ai,1) norm(full(Ai),1)
@test norm(Ai,Inf) norm(full(Ai),Inf)
@test vecnorm(Ai) vecnorm(full(Ai))
Ai = trunc(Int,Ar*100)
@test norm(Ai,1) norm(full(Ai),1)
@test norm(Ai,Inf) norm(full(Ai),Inf)
@test vecnorm(Ai) vecnorm(full(Ai))
Ai = round(Int,Ar*100)
@test norm(Ai,1) norm(full(Ai),1)
@test norm(Ai,Inf) norm(full(Ai),Inf)
@test vecnorm(Ai) vecnorm(full(Ai))

# test sparse matrix cond
A = sparse(reshape([1.0],1,1))
Expand Down

0 comments on commit 3815812

Please sign in to comment.