Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.

Commit 464f417

Browse files
Merge pull request #174 from SciML/auto-juliaformatter-pr
Automatic JuliaFormatter.jl run
2 parents c86f900 + 734ebaf commit 464f417

24 files changed

+108
-84
lines changed

ext/SimpleNonlinearSolveChainRulesCoreExt.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ using SimpleNonlinearSolve: SimpleNonlinearSolve, ImmutableNonlinearProblem
1010
function ChainRulesCore.rrule(::typeof(SimpleNonlinearSolve.__internal_solve_up),
1111
prob::Union{ImmutableNonlinearProblem, NonlinearLeastSquaresProblem},
1212
sensealg, u0, u0_changed, p, p_changed, alg, args...; kwargs...)
13-
out, ∇internal = DiffEqBase._solve_adjoint(
13+
out,
14+
∇internal = DiffEqBase._solve_adjoint(
1415
prob, sensealg, u0, p, ChainRulesOriginator(), alg, args...; kwargs...)
1516
function ∇__internal_solve_up(Δ)
1617
∂f, ∂prob, ∂sensealg, ∂u0, ∂p, ∂originator, ∂args... = ∇internal(Δ)

ext/SimpleNonlinearSolveReverseDiffExt.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ for pType in (ImmutableNonlinearProblem, NonlinearLeastSquaresProblem)
5252
ReverseDiff.@grad function __internal_solve_up(
5353
prob::$(pType), sensealg, u0, u0_changed,
5454
p, p_changed, alg, args...; kwargs...)
55-
out, ∇internal = DiffEqBase._solve_adjoint(
55+
out,
56+
∇internal = DiffEqBase._solve_adjoint(
5657
prob, sensealg, ReverseDiff.value(u0), ReverseDiff.value(p),
5758
ReverseDiffOriginator(), alg, args...; kwargs...)
5859
function ∇__internal_solve_up(_args...)

ext/SimpleNonlinearSolveTaylorDiffExt.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ function SciMLBase.__solve(prob::ImmutableNonlinearProblem, alg::SimpleHousehold
3838
@bb xo = copy(x)
3939
f = __fixed_parameter_function(prob)
4040

41-
abstol, reltol, tc_cache = init_termination_cache(
42-
prob, abstol, reltol, fx, x, termination_condition)
41+
abstol, reltol,
42+
tc_cache = init_termination_cache(prob, abstol, reltol, fx, x, termination_condition)
4343

4444
for i in 1:maxiters
4545
num, den, fx = __get_higher_order_derivatives(alg, prob, f, x, fx)

ext/SimpleNonlinearSolveTrackerExt.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,13 @@ for pType in (ImmutableNonlinearProblem, NonlinearLeastSquaresProblem)
3333
p_, p_changed, alg, args...; kwargs...)
3434
u0, p = Tracker.data(u0_), Tracker.data(p_)
3535
prob = remake(_prob; u0, p)
36-
out, ∇internal = DiffEqBase._solve_adjoint(
36+
out,
37+
∇internal = DiffEqBase._solve_adjoint(
3738
prob, sensealg, u0, p, TrackerOriginator(), alg, args...; kwargs...)
3839

3940
function ∇__internal_solve_up(Δ)
40-
∂prob, ∂sensealg, ∂u0, ∂p, ∂originator, ∂args... = ∇internal(Tracker.data(Δ))
41+
∂prob, ∂sensealg, ∂u0, ∂p, ∂originator,
42+
∂args... = ∇internal(Tracker.data(Δ))
4143
return (∂prob, ∂sensealg, ∂u0, nothing, ∂p, nothing, nothing, ∂args...)
4244
end
4345

src/ad.jl

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,16 @@ function __nlsolve_ad(prob::NonlinearLeastSquaresProblem, alg, args...; kwargs..
9090
return nothing
9191
end
9292
else
93-
_F = @closure (u, p) -> begin
93+
_F = @closure (
94+
u, p) -> begin
9495
resid = prob.f(u, p)
9596
return reshape(2 .* prob.f.vjp(resid, u, p), size(u))
9697
end
9798
end
9899
elseif SciMLBase.has_jac(prob.f)
99100
if isinplace(prob)
100-
_F = @closure (du, u, p) -> begin
101+
_F = @closure (
102+
du, u, p) -> begin
101103
J = __similar(du, length(sol.resid), length(u))
102104
prob.f.jac(J, u, p)
103105
resid = __similar(du, length(sol.resid))
@@ -106,13 +108,15 @@ function __nlsolve_ad(prob::NonlinearLeastSquaresProblem, alg, args...; kwargs..
106108
return nothing
107109
end
108110
else
109-
_F = @closure (u, p) -> begin
111+
_F = @closure (u,
112+
p) -> begin
110113
return reshape(2 .* vec(prob.f(u, p))' * prob.f.jac(u, p), size(u))
111114
end
112115
end
113116
else
114117
if isinplace(prob)
115-
_F = @closure (du, u, p) -> begin
118+
_F = @closure (du, u,
119+
p) -> begin
116120
_f = @closure (du, u) -> prob.f(du, u, p)
117121
resid = __similar(du, length(sol.resid))
118122
v, J = DI.value_and_jacobian(_f, resid, AutoForwardDiff(), u)
@@ -128,7 +132,8 @@ function __nlsolve_ad(prob::NonlinearLeastSquaresProblem, alg, args...; kwargs..
128132
return __zygote_compute_nlls_vjp(_f, u, p)
129133
end
130134
else
131-
_F = @closure (u, p) -> begin
135+
_F = @closure (
136+
u, p) -> begin
132137
_f = Base.Fix2(prob.f, p)
133138
v, J = DI.value_and_jacobian(_f, AutoForwardDiff(), u)
134139
return reshape(2 .* vec(v)' * J, size(u))

src/bracketing/bisection.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,10 @@ function SciMLBase.solve(prob::IntervalNonlinearProblem, alg::Bisection,
7272
end
7373
end
7474

75-
sol, i, left, right, fl, fr = __bisection(
76-
left, right, fl, fr, f; abstol, maxiters = maxiters - i, prob, alg)
75+
sol, i,
76+
left,
77+
right,
78+
fl, fr = __bisection(left, right, fl, fr, f; abstol, maxiters = maxiters - i, prob, alg)
7779

7880
sol !== nothing && return sol
7981

src/bracketing/brent.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,10 @@ function SciMLBase.solve(prob::IntervalNonlinearProblem, alg::Brent, args...;
109109
end
110110
end
111111

112-
sol, i, left, right, fl, fr = __bisection(
113-
left, right, fl, fr, f; abstol, maxiters = maxiters - i, prob, alg)
112+
sol, i,
113+
left,
114+
right,
115+
fl, fr = __bisection(left, right, fl, fr, f; abstol, maxiters = maxiters - i, prob, alg)
114116

115117
sol !== nothing && return sol
116118

src/bracketing/falsi.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,10 @@ function SciMLBase.solve(prob::IntervalNonlinearProblem, alg::Falsi, args...;
6767
end
6868
end
6969

70-
sol, i, left, right, fl, fr = __bisection(
71-
left, right, fl, fr, f; abstol, maxiters = maxiters - i, prob, alg)
70+
sol, i,
71+
left,
72+
right,
73+
fl, fr = __bisection(left, right, fl, fr, f; abstol, maxiters = maxiters - i, prob, alg)
7274
sol !== nothing && return sol
7375

7476
return SciMLBase.build_solution(

src/bracketing/ridder.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,10 @@ function SciMLBase.solve(prob::IntervalNonlinearProblem, alg::Ridder, args...;
7474
end
7575
end
7676

77-
sol, i, left, right, fl, fr = __bisection(
78-
left, right, fl, fr, f; abstol, maxiters = maxiters - i, prob, alg)
77+
sol, i,
78+
left,
79+
right,
80+
fl, fr = __bisection(left, right, fl, fr, f; abstol, maxiters = maxiters - i, prob, alg)
7981
sol !== nothing && return sol
8082

8183
return SciMLBase.build_solution(

src/linesearch.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ function __generic_init(alg::LiFukushimaLineSearch, prob, fu, u)
5050
@bb fu_cache = similar(fu)
5151
T = promote_type(eltype(fu), eltype(u))
5252

53-
ϕ = @closure (u, δu, α) -> begin
53+
ϕ = @closure (u, δu,
54+
α) -> begin
5455
@bb @. u_cache = u + α * δu
5556
return NONLINEARSOLVE_DEFAULT_NORM(__eval_f(prob, fu_cache, u_cache))
5657
end

0 commit comments

Comments
 (0)