We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5f531f7 commit 7f54266Copy full SHA for 7f54266
lib/SimpleNonlinearSolve/src/halley.jl
@@ -42,6 +42,7 @@ function SciMLBase.__solve(prob::NonlinearProblem,
42
maxiters = 1000, kwargs...)
43
f = Base.Fix2(prob.f, prob.p)
44
x = float(prob.u0)
45
+ fx = f(x)
46
if isa(x, AbstractArray)
47
n = length(x)
48
end
@@ -70,7 +71,7 @@ function SciMLBase.__solve(prob::NonlinearProblem,
70
71
else
72
fx = f(x)
73
dfx = ForwardDiff.jacobian(f, x)
- d2fx = ForwardDiff.jacobian(x -> ForwardDiff.jacobian(f, x), x) # n^2 by n matrix
74
+ d2fx = ForwardDiff.jacobian(x -> ForwardDiff.jacobian(f, x), x)
75
ai = -(dfx \ fx)
76
A = reshape(d2fx * ai, (n, n))
77
bi = (dfx) \ (A * ai)
0 commit comments