From 17fbcdc4aeaa434ed27ae318430cb26bf6baf5b3 Mon Sep 17 00:00:00 2001 From: lxvm Date: Thu, 22 Feb 2024 20:05:16 -0500 Subject: [PATCH] avoid some boxing --- src/expectation.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/expectation.jl b/src/expectation.jl index 4c8a2bf..f3a3864 100644 --- a/src/expectation.jl +++ b/src/expectation.jl @@ -63,14 +63,14 @@ function build_integrand(prob::ExpectationProblem{F}, ::Koopman, mid, p, batch::Integer) where {F <: SystemMap} @unpack S, g, h, d = prob - prob_func = function (prob, i, repeat, x) # TODO is it better to make prob/output funcs outside of integrand, then call w/ closure? - u0, p = h((_make_view(x, i)), prob.u0, prob.p) - remake(prob, u0 = u0, p = p) + function prob_func(prob, i, repeat, x) # TODO is it better to make prob/output funcs outside of integrand, then call w/ closure? + u0, _p = h((_make_view(x, i)), prob.u0, prob.p) + remake(prob, u0 = u0, p = _p) end output_func(sol, i, x) = (g(sol, sol.prob.p) * pdf(d, (_make_view(x, i))), false) - function integrand_koopman_systemmap_batch(x, p) + function integrand_koopman_systemmap_batch(x, _) trajectories = size(x)[end] # TODO How to inject ensemble method in solve? currently in SystemMap, but does that make sense? ensprob = EnsembleProblem(S.prob; output_func = (sol, i) -> output_func(sol, i, x),