Skip to content
This repository was archived by the owner on Jun 24, 2022. It is now read-only.

Commit 1cfad3a

Browse files
committed
delete old basics.jl test file
1 parent 92b8656 commit 1cfad3a

File tree

3 files changed

+29
-23
lines changed

3 files changed

+29
-23
lines changed

test/basics.jl

Lines changed: 0 additions & 20 deletions
This file was deleted.

test/jacobian.jl

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,33 @@ let
1616
@test sparse(jactestmeta(f, [1], [2])) == sparse([], [], true, 1, 1)
1717

1818
g(y,x) = y[:] .= x .+ 1
19-
#g(y,x) = y .= x .+ 1 -- memmove
19+
#g(y,x) = y .= x .+ 1 -- memove
2020

21-
@test sparse(jactestmeta(g, [1], [2])) == sparse([1], [1], true)
21+
@test sparse(jactestmeta(g, [1], [2])[1]) == sparse([1], [1], true)
22+
# test path of unsafe_copy from Input to Output
23+
@test sparsity!((y,x) -> y .= x, [1,2,3], [1,2,3]) == sparse([1,2,3], [1,2,3], true)
24+
# test path of unsafe_copy from Input to an intermediary
25+
@test sparsity!((y,x) -> y[1:2] .= x[2:3], [1,2,3], [1,2,3]) == sparse([1,2],[2,3],true, 3,3)
26+
27+
using LinearAlgebra, SparsityDetection
28+
29+
function testsparse!(out, x)
30+
A = Tridiagonal(x[2:end], x, x[1:end-1])
31+
mul!(out, A, x)
32+
end
33+
x = [1:4;]; out = similar(x);
34+
@test sparsity!(testsparse!, out, x) == sparse([1,2,1,2,3,2,3,4,3,4],
35+
[1,1,2,2,2,3,3,3,4,4], true)
36+
end
37+
38+
@testset "BLAS" begin
39+
function f(out,in)
40+
A = rand(length(in), length(in))
41+
out .= A * in
42+
return nothing
43+
end
44+
45+
x = [1.0:10;]
46+
out = similar(x)
47+
@test all(sparsity!(f, out, x) .== 1)
2248
end

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
include("common.jl")
22

3-
@testset "Basics" begin include("jacobian.jl") end
3+
@testset "Jacobian Sparsity" begin include("jacobian.jl") end
44
@testset "Hessian sparsity" begin include("hessian.jl") end
55
@testset "Paraboloid example" begin include("paraboloid.jl") end
66

0 commit comments

Comments
 (0)