Skip to content

Commit 39a334b

Browse files
refactor: remove HomotopyContinuationProblem
1 parent 1b7261a commit 39a334b

File tree

1 file changed

+0
-90
lines changed

1 file changed

+0
-90
lines changed

src/systems/nonlinear/homotopy_continuation.jl

Lines changed: 0 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,93 +1,3 @@
1-
"""
2-
$(TYPEDEF)
3-
4-
A type of Nonlinear problem which specializes on polynomial systems and uses
5-
HomotopyContinuation.jl to solve the system. Requires importing HomotopyContinuation.jl to
6-
create and solve.
7-
"""
8-
struct HomotopyContinuationProblem{uType, H, D, O, SS, U} <:
9-
SciMLBase.AbstractNonlinearProblem{uType, true}
10-
"""
11-
The initial values of states in the system. If there are multiple real roots of
12-
the system, the one closest to this point is returned.
13-
"""
14-
u0::uType
15-
"""
16-
A subtype of `HomotopyContinuation.AbstractSystem` to solve. Also contains the
17-
parameter object.
18-
"""
19-
homotopy_continuation_system::H
20-
"""
21-
A function with signature `(u, p) -> resid`. In case of rational functions, this
22-
is used to rule out roots of the system which would cause the denominator to be
23-
zero.
24-
"""
25-
denominator::D
26-
"""
27-
The `NonlinearSystem` used to create this problem. Used for symbolic indexing.
28-
"""
29-
sys::NonlinearSystem
30-
"""
31-
A function which generates and returns observed expressions for the given system.
32-
"""
33-
obsfn::O
34-
"""
35-
The HomotopyContinuation.jl solver and start system, obtained through
36-
`HomotopyContinuation.solver_startsystems`.
37-
"""
38-
solver_and_starts::SS
39-
"""
40-
A function which takes a solution of the transformed system, and returns a vector
41-
of solutions for the original system. This is utilized when converting systems
42-
to polynomials.
43-
"""
44-
unpack_solution::U
45-
end
46-
47-
function HomotopyContinuationProblem(::AbstractSystem, _u0, _p; kwargs...)
48-
error("HomotopyContinuation.jl is required to create and solve `HomotopyContinuationProblem`s. Please run `Pkg.add(\"HomotopyContinuation\")` to continue.")
49-
end
50-
51-
"""
52-
$(TYPEDSIGNATURES)
53-
54-
Utility function for `safe_HomotopyContinuationProblem`, implemented in the extension.
55-
"""
56-
function _safe_HomotopyContinuationProblem end
57-
58-
"""
59-
$(TYPEDSIGNATURES)
60-
61-
Return a `HomotopyContinuationProblem` if the extension is loaded and the system is
62-
polynomial. If the extension is not loaded, return `nothing`. If the system is not
63-
polynomial, return the appropriate `NotPolynomialError`.
64-
"""
65-
function safe_HomotopyContinuationProblem(sys::NonlinearSystem, args...; kwargs...)
66-
if Base.get_extension(ModelingToolkit, :MTKHomotopyContinuationExt) === nothing
67-
return nothing
68-
end
69-
return _safe_HomotopyContinuationProblem(sys, args...; kwargs...)
70-
end
71-
72-
SymbolicIndexingInterface.symbolic_container(p::HomotopyContinuationProblem) = p.sys
73-
SymbolicIndexingInterface.state_values(p::HomotopyContinuationProblem) = p.u0
74-
function SymbolicIndexingInterface.set_state!(p::HomotopyContinuationProblem, args...)
75-
set_state!(p.u0, args...)
76-
end
77-
function SymbolicIndexingInterface.parameter_values(p::HomotopyContinuationProblem)
78-
parameter_values(p.homotopy_continuation_system)
79-
end
80-
function SymbolicIndexingInterface.set_parameter!(p::HomotopyContinuationProblem, args...)
81-
set_parameter!(parameter_values(p), args...)
82-
end
83-
function SymbolicIndexingInterface.observed(p::HomotopyContinuationProblem, sym)
84-
if p.obsfn !== nothing
85-
return p.obsfn(sym)
86-
else
87-
return SymbolicIndexingInterface.observed(p.sys, sym)
88-
end
89-
end
90-
911
function contains_variable(x, wrt)
922
any(y -> occursin(y, x), wrt)
933
end

0 commit comments

Comments
 (0)