Skip to content

Commit

Permalink
JuliaFormatter.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanaelbosch committed Aug 30, 2024
1 parent e4ea30c commit d612f3e
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 11 deletions.
4 changes: 3 additions & 1 deletion src/ProbNumDiffEq.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ using Reexport
@reexport using DiffEqBase
import SciMLBase
import SciMLBase: interpret_vars, getsyms, remake
using OrdinaryDiffEqCore, OrdinaryDiffEqDifferentiation, OrdinaryDiffEqVerner,
using OrdinaryDiffEqCore,
OrdinaryDiffEqDifferentiation,
OrdinaryDiffEqVerner,
OrdinaryDiffEqRosenbrock
using ToeplitzMatrices
using FastBroadcast
Expand Down
11 changes: 8 additions & 3 deletions src/alg_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,15 @@ OrdinaryDiffEqDifferentiation.concrete_jac(::AbstractEK) = nothing
OrdinaryDiffEqCore.isfsal(::AbstractEK) = false

for ALG in [:EK1, :DiagonalEK1]
@eval OrdinaryDiffEqDifferentiation._alg_autodiff(::$ALG{CS,AD}) where {CS,AD} = Val{AD}()
@eval OrdinaryDiffEqDifferentiation.alg_difftype(::$ALG{CS,AD,DiffType}) where {CS,AD,DiffType} =
@eval OrdinaryDiffEqDifferentiation._alg_autodiff(::$ALG{CS,AD}) where {CS,AD} =
Val{AD}()
@eval OrdinaryDiffEqDifferentiation.alg_difftype(
::$ALG{CS,AD,DiffType},
) where {CS,AD,DiffType} =
DiffType
@eval OrdinaryDiffEqDifferentiation.standardtag(::$ALG{CS,AD,DiffType,ST}) where {CS,AD,DiffType,ST} =
@eval OrdinaryDiffEqDifferentiation.standardtag(
::$ALG{CS,AD,DiffType,ST},
) where {CS,AD,DiffType,ST} =
ST
@eval OrdinaryDiffEqDifferentiation.concrete_jac(
::$ALG{CS,AD,DiffType,ST,CJ},
Expand Down
7 changes: 5 additions & 2 deletions src/caches.jl
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ mutable struct EKCache{
jac_config::JC
end

OrdinaryDiffEqCore.get_fsalfirstlast(cache::AbstractODEFilterCache, rate_prototype) = (nothing, nothing)
OrdinaryDiffEqCore.get_fsalfirstlast(cache::AbstractODEFilterCache, rate_prototype) =
(nothing, nothing)

function OrdinaryDiffEqCore.alg_cache(
alg::AbstractEK,
Expand Down Expand Up @@ -224,7 +225,9 @@ function OrdinaryDiffEqCore.alg_cache(
dw1 = zero(u)
atmp = similar(u, uEltypeNoUnits)
if OrdinaryDiffEqCore.isimplicit(alg)
jac_config = OrdinaryDiffEqDifferentiation.build_jac_config(alg, f, uf, du1, uprev, u, tmp, dw1)
jac_config = OrdinaryDiffEqDifferentiation.build_jac_config(
alg, f, uf, du1, uprev, u, tmp, dw1,
)
else
jac_config = nothing
end
Expand Down
14 changes: 11 additions & 3 deletions src/integrator_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ ProbNumDiffEq.jl-specific implementation of OrdinaryDiffEqCore.jl's `postamble!`
In addition to calling `OrdinaryDiffEqCore._postamble!(integ)`, calibrate the diffusion and
smooth the solution.
"""
function OrdinaryDiffEqCore.postamble!(integ::OrdinaryDiffEqCore.ODEIntegrator{<:AbstractEK})
function OrdinaryDiffEqCore.postamble!(
integ::OrdinaryDiffEqCore.ODEIntegrator{<:AbstractEK},
)
# OrdinaryDiffEqCore.jl-related calls:
OrdinaryDiffEqCore._postamble!(integ)
copyat_or_push!(integ.sol.k, integ.saveiter_dense, integ.k)
Expand Down Expand Up @@ -150,7 +152,11 @@ function DiffEqBase.savevalues!(
# Save our custom stuff that we need for the posterior
if integ.opts.save_everystep
i = integ.saveiter
OrdinaryDiffEqCore.copyat_or_push!(integ.sol.diffusions, i, integ.cache.local_diffusion)
OrdinaryDiffEqCore.copyat_or_push!(
integ.sol.diffusions,
i,
integ.cache.local_diffusion,
)
OrdinaryDiffEqCore.copyat_or_push!(integ.sol.x_filt, i, integ.cache.x)
_gaussian_mul!(integ.cache.pu_tmp, integ.cache.SolProj, integ.cache.x)
OrdinaryDiffEqCore.copyat_or_push!(integ.sol.pu, i, integ.cache.pu_tmp)
Expand All @@ -164,7 +170,9 @@ function DiffEqBase.savevalues!(
return out
end

function OrdinaryDiffEqCore.update_uprev!(integ::OrdinaryDiffEqCore.ODEIntegrator{<:AbstractEK})
function OrdinaryDiffEqCore.update_uprev!(
integ::OrdinaryDiffEqCore.ODEIntegrator{<:AbstractEK},
)
@assert !OrdinaryDiffEqCore.alg_extrapolates(integ.alg)
@assert isinplace(integ.sol.prob)
@assert !(integ.alg isa OrdinaryDiffEqCore.DAEAlgorithm)
Expand Down
12 changes: 10 additions & 2 deletions src/perform_step.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Called in the OrdinaryDiffEqCore.__init; All `OrdinaryDiffEqAlgorithm`s have one
function OrdinaryDiffEqCore.initialize!(integ::OrdinaryDiffEqCore.ODEIntegrator, cache::EKCache)
function OrdinaryDiffEqCore.initialize!(
integ::OrdinaryDiffEqCore.ODEIntegrator,
cache::EKCache,
)
check_secondorderode(integ)
check_densesmooth(integ)
check_saveiter(integ)
Expand Down Expand Up @@ -73,7 +76,12 @@ function OrdinaryDiffEqCore.perform_step!(integ, cache::EKCache, repeat_step=fal
if make_new_transitions(integ, cache, repeat_step)
# Rosenbrock-style update of the IOUP rate parameter
if cache.prior isa IOUP && cache.prior.update_rate_parameter
OrdinaryDiffEqDifferentiation.calc_J!(cache.prior.rate_parameter, integ, cache, false)
OrdinaryDiffEqDifferentiation.calc_J!(
cache.prior.rate_parameter,
integ,
cache,
false,
)
end

make_transition_matrices!(cache, cache.prior, dt)
Expand Down

0 comments on commit d612f3e

Please sign in to comment.