diff --git a/R/diffeqr.R b/R/diffeqr.R index 7f613fd..fbadf0a 100644 --- a/R/diffeqr.R +++ b/R/diffeqr.R @@ -70,6 +70,8 @@ jitoptimize_ode <- function (de,prob){ mtk <- julia_pkg_import("ModelingToolkit",functions) odesys = mtk$modelingtoolkitize(prob) + odesys = mtk$structural_simplify(odesys) + JuliaCall::julia_assign("odesys", odesys) jul_f = JuliaCall::julia_eval("jitf = ODEFunction(odesys,jac=true)") JuliaCall::julia_assign("u0", prob$u0) @@ -104,6 +106,7 @@ jitoptimize_sde <- function (de,prob){ mtk <- julia_pkg_import("ModelingToolkit",functions) sdesys = mtk$modelingtoolkitize(prob) + sdesys = mtk$structural_simplify(sdesys) JuliaCall::julia_assign("sdesys", sdesys) jul_f = JuliaCall::julia_eval("jitf = SDEFunction(sdesys,jac=true)") JuliaCall::julia_assign("u0", prob$u0)