Skip to content

Commit

Permalink
Merge pull request #7 from SciML/retcode
Browse files Browse the repository at this point in the history
Fix return codes
  • Loading branch information
ChrisRackauckas authored Nov 24, 2022
2 parents 7529838 + 9667029 commit a9839b4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 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.1"
version = "0.1.2"

[deps]
ArrayInterfaceCore = "30b0a656-2188-435a-8636-2ec0e6a096e2"
Expand Down
4 changes: 2 additions & 2 deletions lib/SimpleNonlinearSolve/src/raphson.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ function SciMLBase.solve(prob::NonlinearProblem,
fx)
end
iszero(fx) &&
return SciMLBase.build_solution(prob, alg, x, fx; retcode = ReturnCode.Default)
return SciMLBase.build_solution(prob, alg, x, fx; retcode = ReturnCode.Success)
Δx = dfx \ fx
x -= Δx
if isapprox(x, xo, atol = atol, rtol = rtol)
return SciMLBase.build_solution(prob, alg, x, fx; retcode = ReturnCode.Default)
return SciMLBase.build_solution(prob, alg, x, fx; retcode = ReturnCode.Success)
end
xo = x
end
Expand Down
2 changes: 1 addition & 1 deletion lib/SimpleNonlinearSolve/test/basictests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ end
const csu0 = 1.0

sol = benchmark_scalar(sf, csu0)
@test sol.retcode === ReturnCode.Default
@test sol.retcode === ReturnCode.Success
@test sol.u * sol.u - 2 < 1e-9

@test (@ballocated benchmark_scalar(sf, csu0)) == 0
Expand Down

0 comments on commit a9839b4

Please sign in to comment.