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

Commit

Permalink
add README example
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisRackauckas committed Apr 5, 2020
1 parent f29d70a commit 2a89e1f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/examples.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
fcalls = 0
function f(dx,x)
global fcalls += 1
for i in 2:length(x)-1
dx[i] = x[i-1] - 2x[i] + x[i+1]
end
dx[1] = -2x[1] + x[2]
dx[end] = x[end-1] - 2x[end]
nothing
end

using SparsityDetection, SparseArrays
input = rand(10)
output = similar(input)
sparsity_pattern = sparsity!(f,output,input)
jac = Float64.(sparse(sparsity_pattern))
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ include("common.jl")
@testset "Exploration" begin include("ifsandbuts.jl") end
@testset "Hessian sparsity" begin include("hessian.jl") end
@testset "Paraboloid example" begin include("paraboloid.jl") end
@safetestset "Simple examples" begin include("examples.jl") end
@safetestset "Global PDE example" begin include("global_PDE.jl") end

0 comments on commit 2a89e1f

Please sign in to comment.