Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisRackauckas committed Dec 4, 2022
1 parent 436b866 commit ef03881
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
5 changes: 3 additions & 2 deletions src/jacobian.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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),
Expand Down
5 changes: 3 additions & 2 deletions src/raphson.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,16 @@ 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)

uf, linsolve, J, du1, jac_config
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,
Expand Down
11 changes: 6 additions & 5 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit ef03881

Please sign in to comment.