Skip to content

Commit

Permalink
improve badge
Browse files Browse the repository at this point in the history
  • Loading branch information
rveltz committed Dec 1, 2018
1 parent 164bad3 commit 94f0ea4
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ matrix:
- julia: nightly
# uncomment the following lines to override the default test script
script:
- julia -e 'using Pkg; Pkg.clone(pwd()); Pkg.build("PiecewiseDeterministicMarkovProcesses"); Pkg.test("PiecewiseDeterministicMarkovProcesses"; coverage=true)'
- julia -e 'using Pkg; Pkg.test("PiecewiseDeterministicMarkovProcesses"; coverage=true)'
after_success:
# push coverage results to Codecov and Coveralls
- julia -e 'using Pkg; Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder()); Coveralls.submit(Coveralls.process_folder())'
Expand Down
44 changes: 44 additions & 0 deletions examples/issueForwardDiff.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using Revise, PiecewiseDeterministicMarkovProcesses, LinearAlgebra, Random, DifferentialEquations

function F_fd!(ẋ, xc, xd, t, parms)
# vector field used for the continuous variable
if mod(xd[1],2)==0
ẋ[1] = 1 + xd[1] + 0
else
ẋ[1] = -xc[1]
end
nothing
end

rate_tcp(x) = 1/x

function R_fd!(rate, xc, xd, t, parms, sum_rate::Bool)
rate[1] = 1.0 + rate_tcp(xc[1]) * xc[1]
if sum_rate==false
return 0., 0.
else
return sum(rate), 0.
end
end

xc0 = [ 1.0 ]
xd0 = [ 1. ]

nu_fd = [[1 0];[0 -1]]
parms = [0.0]

# works:
Random.seed!(12)
res = @time PDMP.pdmp!(xc0, xd0, F_fd!, R_fd!, nu_fd, parms, 0.0, 10.0, n_jumps = 3, ode = CVODE_BDF())

# fail because of autodiff
Random.seed!(12)
res = @time PDMP.pdmp!(xc0, xd0, F_fd!, R_fd!, nu_fd, parms, 0.0, 10.0, n_jumps = 3, ode = Rosenbrock23())




# using StaticArrays
# sxc0 = @MVector [ 1.0 ]
# sxd0 = @MVector [1, 1]
# res = @time PDMP.pdmp!(xc0, xd0, F_fd!, R_fd!, nu_fd, parms, 0.0, 1.0, n_jumps = 3, ode = Tsit5())

0 comments on commit 94f0ea4

Please sign in to comment.