Skip to content

Commit

Permalink
Merge pull request #88 from SciML/auto-juliaformatter-pr
Browse files Browse the repository at this point in the history
Automatic JuliaFormatter.jl run
  • Loading branch information
ChrisRackauckas committed Oct 21, 2023
2 parents 283ca63 + 723c667 commit 89a4b85
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/broyden.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ function SciMLBase.__solve(prob::NonlinearProblem, alg::Broyden, args...;
Δxₙ = xₙ - xₙ₋₁
Δfₙ = fₙ - fₙ₋₁
J⁻¹Δfₙ = _restructure(Δfₙ, J⁻¹ * _vec(Δfₙ))
J⁻¹ += _restructure(J⁻¹, ((_vec(Δxₙ) .- _vec(J⁻¹Δfₙ)) ./ (_vec(Δxₙ)' * _vec(J⁻¹Δfₙ))) * (_vec(Δxₙ)' * J⁻¹))
J⁻¹ += _restructure(J⁻¹,
((_vec(Δxₙ) .- _vec(J⁻¹Δfₙ)) ./ (_vec(Δxₙ)' * _vec(J⁻¹Δfₙ))) *
(_vec(Δxₙ)' * J⁻¹))

if termination_condition(fₙ, xₙ, xₙ₋₁, atol, rtol)
return SciMLBase.build_solution(prob, alg, xₙ, fₙ; retcode = ReturnCode.Success)
Expand Down
2 changes: 1 addition & 1 deletion src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,4 @@ end
@inline _vec(v::AbstractVector) = v

@inline _restructure(y::Number, x::Number) = x
@inline _restructure(y, x) = ArrayInterface.restructure(y,x)
@inline _restructure(y, x) = ArrayInterface.restructure(y, x)
2 changes: 1 addition & 1 deletion test/matrix_resizing_tests.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using SimpleNonlinearSolve

ff(u, p) = u .* u .- p
u0 = rand(2,2)
u0 = rand(2, 2)
p = 2.0
vecprob = NonlinearProblem(ff, vec(u0), p)
prob = NonlinearProblem(ff, u0, p)
Expand Down

0 comments on commit 89a4b85

Please sign in to comment.