Skip to content

Commit 552b039

Browse files
fix: respect use_homotopy_continuation in NonlinearProblem and default it to false
1 parent 51aea4a commit 552b039

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/systems/nonlinear/nonlinearsystem.jl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -496,13 +496,15 @@ end
496496

497497
function DiffEqBase.NonlinearProblem{iip}(sys::NonlinearSystem, u0map,
498498
parammap = DiffEqBase.NullParameters();
499-
check_length = true, use_homotopy_continuation = true, kwargs...) where {iip}
499+
check_length = true, use_homotopy_continuation = false, kwargs...) where {iip}
500500
if !iscomplete(sys)
501501
error("A completed `NonlinearSystem` is required. Call `complete` or `structural_simplify` on the system before creating a `NonlinearProblem`")
502502
end
503-
prob = safe_HomotopyContinuationProblem(sys, u0map, parammap; check_length, kwargs...)
504-
if prob isa HomotopyContinuationProblem
505-
return prob
503+
if use_homotopy_continuation
504+
prob = safe_HomotopyContinuationProblem(sys, u0map, parammap; check_length, kwargs...)
505+
if prob isa HomotopyContinuationProblem
506+
return prob
507+
end
506508
end
507509
f, u0, p = process_SciMLProblem(NonlinearFunction{iip}, sys, u0map, parammap;
508510
check_length, kwargs...)

test/extensions/homotopy_continuation.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import HomotopyContinuation
2929
@test SciMLBase.successful_retcode(sol)
3030
@test norm(sol.resid)0.0 atol=1e-10
3131

32-
prob2 = NonlinearProblem(sys, u0)
32+
prob2 = NonlinearProblem(sys, u0; use_homotopy_continuation = true)
3333
@test prob2 isa HomotopyContinuationProblem
3434
sol = solve(prob2; threading = false)
3535
@test SciMLBase.successful_retcode(sol)

0 commit comments

Comments
 (0)