diff --git a/lib/SimpleNonlinearSolve/src/broyden.jl b/lib/SimpleNonlinearSolve/src/broyden.jl index 9f3c22505..045345f29 100644 --- a/lib/SimpleNonlinearSolve/src/broyden.jl +++ b/lib/SimpleNonlinearSolve/src/broyden.jl @@ -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) diff --git a/lib/SimpleNonlinearSolve/src/utils.jl b/lib/SimpleNonlinearSolve/src/utils.jl index c0245ece0..1c4400026 100644 --- a/lib/SimpleNonlinearSolve/src/utils.jl +++ b/lib/SimpleNonlinearSolve/src/utils.jl @@ -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) \ No newline at end of file +@inline _restructure(y, x) = ArrayInterface.restructure(y, x) diff --git a/lib/SimpleNonlinearSolve/test/matrix_resizing_tests.jl b/lib/SimpleNonlinearSolve/test/matrix_resizing_tests.jl index 9612cbb68..9a1989b71 100644 --- a/lib/SimpleNonlinearSolve/test/matrix_resizing_tests.jl +++ b/lib/SimpleNonlinearSolve/test/matrix_resizing_tests.jl @@ -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)