From edb343627fed6d68f96c219443617fd6358c58c3 Mon Sep 17 00:00:00 2001 From: Nathanael Bosch Date: Sun, 3 Oct 2021 14:32:02 +0200 Subject: [PATCH] Fix small bug: Ensure the correct linearization at the given point --- src/perform_step.jl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/perform_step.jl b/src/perform_step.jl index bc6074e5f..6662a6285 100644 --- a/src/perform_step.jl +++ b/src/perform_step.jl @@ -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 @@ -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}) @@ -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)