Skip to content

Commit

Permalink
clean up, line continuation
Browse files Browse the repository at this point in the history
  • Loading branch information
davideklund committed Jan 30, 2025
1 parent f18fdb1 commit b2d3a1b
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions content/sciml.rst
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,19 @@ acting on the object only depend on its velocity, not its position.
du[4] = u[3]
end
nn_dynamics!(du, u, p, t) = ude_dynamics!(du, u, p, t)
problems = [ODEProblem(nn_dynamics!, ui, tspan, p) for ui in inits_g]
problems = [ODEProblem(ude_dynamics!, ui, tspan, p) for ui in inits_g]
function predict(θ, inits = inits_g, T = times)
_probs = [remake(problems[ii], u0 = inits[ii], tspan = (T[1], T[end]), p = θ) for ii in range(1,size(inits)[1])]
allsols = [Array(solve(_prob, Vern7(), saveat = T, abstol = 1e-6, reltol = 1e-6, sensealg = QuadratureAdjoint(autojacvec = ReverseDiffVJP(true)))) for _prob in _probs]
_probs = [remake(problems[ii], u0 = inits[ii], tspan = (T[1], T[end]), p = θ)
for ii in range(1,size(inits)[1])]
allsols = [Array(solve(_prob,
Vern7(),
saveat = T,
abstol = 1e-6,
reltol = 1e-6,
sensealg = QuadratureAdjoint(autojacvec = ReverseDiffVJP(true)))) for _prob in _probs]
hcat(allsols...)
end
Expand Down

0 comments on commit b2d3a1b

Please sign in to comment.