From ef038810e1b5d80c5cf1288b6f8a711bac544bc9 Mon Sep 17 00:00:00 2001 From: Chris Rackauckas Date: Sun, 4 Dec 2022 01:52:22 +0100 Subject: [PATCH] format --- src/jacobian.jl | 5 +++-- src/raphson.jl | 5 +++-- src/utils.jl | 11 ++++++----- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/jacobian.jl b/src/jacobian.jl index 7b6275739..a8ee4050a 100644 --- a/src/jacobian.jl +++ b/src/jacobian.jl @@ -109,7 +109,7 @@ function jacobian_finitediff(f, x::AbstractArray, ::Type{diff_type}, dir, colorv jac_prototype = jac_prototype) return J, _nfcount(maximum(colorvec), diff_type) end -function jacobian(cache, f::F) where F +function jacobian(cache, f::F) where {F} x = cache.u alg = cache.alg uf = cache.uf @@ -136,7 +136,8 @@ function jacobian_autodiff(f, x::AbstractArray, nonlinfun, alg) maxcolor = maximum(colorvec) chunk_size = get_chunksize(alg) === Val(0) ? nothing : get_chunksize(alg) num_of_chunks = chunk_size === nothing ? - Int(ceil(maxcolor / SparseDiffTools.getsize(ForwardDiff.pickchunksize(maxcolor)))) : + Int(ceil(maxcolor / + SparseDiffTools.getsize(ForwardDiff.pickchunksize(maxcolor)))) : Int(ceil(maxcolor / _unwrap_val(chunk_size))) (forwarddiff_color_jacobian(f, x, colorvec = colorvec, sparsity = sparsity, jac_prototype = jac_prototype, chunksize = chunk_size), diff --git a/src/raphson.jl b/src/raphson.jl index 8b390d044..02f6b22a3 100644 --- a/src/raphson.jl +++ b/src/raphson.jl @@ -65,7 +65,8 @@ function jacobian_caches(alg::NewtonRaphson, f, u, p, ::Val{true}) linsolve = init(linprob, alg.linsolve, alias_A = true, alias_b = true, Pl = Pl, Pr = Pr) - du1 = zero(u); du2 = zero(u) + du1 = zero(u) + du2 = zero(u) tmp = zero(u) jac_config = build_jac_config(alg, f, uf, du1, u, tmp, du2) @@ -73,7 +74,7 @@ function jacobian_caches(alg::NewtonRaphson, f, u, p, ::Val{true}) end function jacobian_caches(alg::NewtonRaphson, f, u, p, ::Val{false}) - JacobianWrapper(f,p), nothing, nothing, nothing, nothing + JacobianWrapper(f, p), nothing, nothing, nothing, nothing end function SciMLBase.__init(prob::NonlinearProblem{uType, iip}, alg::NewtonRaphson, diff --git a/src/utils.jl b/src/utils.jl index e781d1a40..f4946091b 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -49,17 +49,18 @@ function alg_difftype(alg::AbstractNewtonAlgorithm{CS, AD, FDT, ST, CJ}) where { end function concrete_jac(alg::AbstractNewtonAlgorithm{CS, AD, FDT, ST, CJ}) where {CS, AD, FDT, - ST, CJ} -CJ + ST, CJ} + CJ end -function get_chunksize(alg::AbstractNewtonAlgorithm{CS, AD, FDT, ST, CJ}) where {CS, AD, FDT, - ST, CJ} +function get_chunksize(alg::AbstractNewtonAlgorithm{CS, AD, FDT, ST, CJ}) where {CS, AD, + FDT, + ST, CJ} Val(CS) end function standardtag(alg::AbstractNewtonAlgorithm{CS, AD, FDT, ST, CJ}) where {CS, AD, FDT, - ST, CJ} + ST, CJ} ST end