Skip to content

Commit

Permalink
error in last jump corrected
Browse files Browse the repository at this point in the history
  • Loading branch information
rveltz committed Feb 15, 2018
1 parent 09322f9 commit 724ff25
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This is a joint work of [Romain Veltz](https://romainveltz.pythonanywhere.com/)

PDMP.jl is a Julia package that allows simulation of *Piecewise Deterministic Markov Processes* (PDMP); these encompass hybrid systems and jump processes, comprised of continuous and discrete components, as well as processes with time-varying rates. The aim of the package is to provide methods for the simulation of these processes that are "exact" up to the ODE integrator.

Please, read the [documentation](https://rveltz.github.io/PDMP.jl/latest) for more information.
<!--Please, read the [documentation](https://rveltz.github.io/PDMP.jl/latest) for more information.-->

We provide several methods for the simulation:

Expand Down
19 changes: 13 additions & 6 deletions src/chv.jl
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,13 @@ function chv!{T}(n_max::Int64,xc0::Vector{Float64},xd0::Array{Int64,1},F::Functi
# save_c && (xc_hist[:,nsteps] .= X0[ind_save_c])
# save_d && (xd_hist[:,nsteps] .= Xd[ind_save_d])
# save_data(nsteps,X0,Xd,xc_hist,xd_hist,ind_save_d, ind_save_c)
@inbounds for ii in length(X0)-1
xc_hist[ii,nsteps] = res_ode_last[end,ii]
end

@inbounds for ii in eachindex(ind_save_c)
xc_hist[ii,nsteps] = res_ode_last[end,ind_save_c[ii]]
end
@inbounds for ii in eachindex(ind_save_d)
xd_hist[ii,nsteps] = Xd[ind_save_d[ii]]
end
end
nsteps += 1
end
Expand Down Expand Up @@ -278,9 +282,12 @@ function chv_optim!{T}(n_max::Int64,xc0::Vector{Float64},xd0::Array{Int64,1}, F:

# save state
t_hist[nsteps] = t
@inbounds for ii in length(X0)-1
xc_hist[ii,nsteps] = res_ode_last[end,ii]
end
@inbounds for ii in eachindex(ind_save_c)
xc_hist[ii,nsteps] = res_ode_last[end,ind_save_c[ii]]
end
@inbounds for ii in eachindex(ind_save_d)
xd_hist[ii,nsteps] = Xd[ind_save_d[ii]]
end
end
nsteps += 1
end
Expand Down

0 comments on commit 724ff25

Please sign in to comment.