Skip to content

Commit

Permalink
Fix small bug: Ensure the correct linearization at the given point
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanaelbosch committed Oct 3, 2021
1 parent 315d267 commit edb3436
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/perform_step.jl
Original file line number Diff line number Diff line change
Expand Up @@ -167,16 +167,16 @@ function evaluate_ode!(integ, x_pred, t, second_order::Val{false})

# Cov
if alg isa EK1 || alg isa IEKS
linearize_at =
u_lin =
(alg isa IEKS && !isnothing(alg.linearize_at)) ? alg.linearize_at(t).μ : u_pred

# Jacobian is now computed either with the given jac, or ForwardDiff
# Jacobian is computed either with the given jac, or ForwardDiff
if !isnothing(f.jac)
_eval_f_jac!(ddu, linearize_at, p, t, f)
_eval_f_jac!(ddu, u_lin, p, t, f)
elseif isinplace(f)
ForwardDiff.jacobian!(ddu, (du, u) -> f(du, u, p, t), du, u_pred)
ForwardDiff.jacobian!(ddu, (du, u) -> f(du, u, p, t), du, u_lin)
else
ddu .= ForwardDiff.jacobian(u -> f(u, p, t), u_pred)
ddu .= ForwardDiff.jacobian(u -> f(u, p, t), u_lin)
end
integ.destats.njacs += 1

Expand All @@ -186,7 +186,7 @@ function evaluate_ode!(integ, x_pred, t, second_order::Val{false})
# _matmul!(H, f.mass_matrix, E1) # This is already the case (see above)
end

return measurement
return nothing
end

function evaluate_ode!(integ, x_pred, t, second_order::Val{true})
Expand All @@ -212,7 +212,7 @@ function evaluate_ode!(integ, x_pred, t, second_order::Val{true})

# Cov
if alg isa EK1
@assert !(alg isa IEKS)
(alg isa IEKS) && error("IEKS is currently not supported for SecondOrderODEProbems")

if isinplace(f)
J0 = copy(ddu)
Expand Down

0 comments on commit edb3436

Please sign in to comment.