Skip to content

Commit

Permalink
Merge pull request #12 from SciML/complex
Browse files Browse the repository at this point in the history
Support complex in newton
  • Loading branch information
ChrisRackauckas authored Dec 24, 2022
2 parents 8d63af7 + 28ac684 commit 64235cd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/SimpleNonlinearSolve/Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "SimpleNonlinearSolve"
uuid = "727e6d20-b764-4bd8-a329-72de5adea6c7"
authors = ["SciML"]
version = "0.1.3"
version = "0.1.4"

[deps]
ArrayInterfaceCore = "30b0a656-2188-435a-8636-2ec0e6a096e2"
Expand Down
7 changes: 5 additions & 2 deletions lib/SimpleNonlinearSolve/src/raphson.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ function SciMLBase.solve(prob::NonlinearProblem,
error("SimpleNewtonRaphson currently only supports out-of-place nonlinear problems")
end

atol = abstol !== nothing ? abstol : oneunit(eltype(T)) * (eps(one(eltype(T))))^(4 // 5)
rtol = reltol !== nothing ? reltol : eps(one(eltype(T)))^(4 // 5)
atol = abstol !== nothing ? abstol :
real(oneunit(eltype(T))) * (eps(real(one(eltype(T)))))^(4 // 5)
rtol = reltol !== nothing ? reltol : eps(real(one(eltype(T))))^(4 // 5)

if typeof(x) <: Number
xo = oftype(one(eltype(x)), Inf)
Expand Down Expand Up @@ -78,5 +79,7 @@ function SciMLBase.solve(prob::NonlinearProblem,
end
xo = x
end

@show x, fx
return SciMLBase.build_solution(prob, alg, x, fx; retcode = ReturnCode.MaxIters)
end

0 comments on commit 64235cd

Please sign in to comment.