Skip to content

Commit

Permalink
Remove write_into_pu again (part 1)
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanaelbosch authored Nov 9, 2023
1 parent 76ed696 commit f65f6b0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 26 deletions.
24 changes: 4 additions & 20 deletions src/integrator_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,7 @@ function calibrate_solution!(integ, mle_diffusion)

# Re-write into the solution estimates
for (pu, x) in zip(integ.sol.pu, integ.sol.x_filt)
write_into_pu!(
pu,
x;
cache=integ.cache,
is_secondorder_ode=integ.f isa DynamicalODEFunction,
)
_gaussian_mul!(pu, integ.cache.SolProj, x)
end
# [(su[:] .= pu) for (su, pu) in zip(integ.sol.u, integ.sol.pu.μ)]
end
Expand Down Expand Up @@ -114,12 +109,7 @@ function smooth_solution!(integ)
K = backward_kernels[i]
marginalize!(x_smooth[i], x_smooth[i+1], K; C_DxD, C_3DxD)

write_into_pu!(
sol.pu[i],
x_smooth[i];
cache=integ.cache,
is_secondorder_ode=integ.f isa DynamicalODEFunction,
)
_gaussian_mul!(sol.pu[i], cache.SolProj, x_smooth[i])
sol.u[i][:] .= sol.pu[i].μ
end
return nothing
Expand All @@ -139,12 +129,7 @@ function pn_solution_endpoint_match_cur_integrator!(integ)
OrdinaryDiffEq.copyat_or_push!(
integ.sol.pu,
integ.saveiter,
write_into_pu!(
integ.cache.pu_tmp,
integ.cache.x;
cache=integ.cache,
is_secondorder_ode=integ.f isa DynamicalODEFunction,
),
_gaussian_mul!(integ.cache.pu_tmp, integ.cache.SolProj, integ.cache.x),
)
end
end
Expand All @@ -164,8 +149,7 @@ function DiffEqBase.savevalues!(
i = integ.saveiter
OrdinaryDiffEq.copyat_or_push!(integ.sol.diffusions, i, integ.cache.local_diffusion)
OrdinaryDiffEq.copyat_or_push!(integ.sol.x_filt, i, integ.cache.x)
write_into_pu!(integ.cache.pu_tmp, integ.cache.x;
cache=integ.cache, is_secondorder_ode=integ.f isa DynamicalODEFunction),
_gaussian_mul!(integ.cache.pu_tmp, integ.cache.SolProj, integ.cache.x)
OrdinaryDiffEq.copyat_or_push!(integ.sol.pu, i, integ.cache.pu_tmp)

if integ.alg.smooth
Expand Down
7 changes: 1 addition & 6 deletions src/perform_step.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,7 @@ function OrdinaryDiffEq.initialize!(integ::OrdinaryDiffEq.ODEIntegrator, cache::

# These are necessary since the solution object is not 100% initialized by default
OrdinaryDiffEq.copyat_or_push!(integ.sol.x_filt, integ.saveiter, cache.x)
initial_pu = write_into_pu!(
cache.pu_tmp,
cache.x;
cache=integ.cache,
is_secondorder_ode=integ.f isa DynamicalODEFunction,
)
initial_pu = _gaussian_mul!(cache.pu_tmp, cache.SolProj, cache.x)
OrdinaryDiffEq.copyat_or_push!(integ.sol.pu, integ.saveiter, initial_pu)

return nothing
Expand Down

0 comments on commit f65f6b0

Please sign in to comment.