From d612f3e251693fdfbb4075bcfee4b816837a75d4 Mon Sep 17 00:00:00 2001 From: Nathanael Bosch Date: Fri, 30 Aug 2024 15:20:15 +0200 Subject: [PATCH] JuliaFormatter.jl --- src/ProbNumDiffEq.jl | 4 +++- src/alg_utils.jl | 11 ++++++++--- src/caches.jl | 7 +++++-- src/integrator_utils.jl | 14 +++++++++++--- src/perform_step.jl | 12 ++++++++++-- 5 files changed, 37 insertions(+), 11 deletions(-) diff --git a/src/ProbNumDiffEq.jl b/src/ProbNumDiffEq.jl index ed144c39c..27f87fd5f 100644 --- a/src/ProbNumDiffEq.jl +++ b/src/ProbNumDiffEq.jl @@ -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 diff --git a/src/alg_utils.jl b/src/alg_utils.jl index 3094060e4..cf9cd7ab8 100644 --- a/src/alg_utils.jl +++ b/src/alg_utils.jl @@ -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}, diff --git a/src/caches.jl b/src/caches.jl index 5bb019bf4..3eaecf962 100644 --- a/src/caches.jl +++ b/src/caches.jl @@ -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, @@ -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 diff --git a/src/integrator_utils.jl b/src/integrator_utils.jl index 0e0e4cfc8..90fae4739 100644 --- a/src/integrator_utils.jl +++ b/src/integrator_utils.jl @@ -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) @@ -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) @@ -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) diff --git a/src/perform_step.jl b/src/perform_step.jl index 3a791b585..9b5393272 100644 --- a/src/perform_step.jl +++ b/src/perform_step.jl @@ -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) @@ -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)