Systems
Systems (AbstractSystem
) are the basic building blocks of homotopies.
HomotopyContinuation.ModelKit.AbstractSystem
— TypeAbstractSystem
An abstract type representing a polynomial system $F(x, p)$ where $x$ are variables and $p$ are possible parameters.
Although they sound similar, AbstractSystem
s and System
share different purposes. AbstractSystem
s are intented for the fast numerical evaluation of a fixed system. Whereas a System
is intended for formulating your problem symbolically. A System
can be converted to two different basic AbstractSystem
s, a CompiledSystem
(fast, but introduce compilation overhead) and an InterpretedSystem
(slower, but not compilation overhead).
HomotopyContinuation.ModelKit.CompiledSystem
— TypeCompiledSystem <: AbstractSystem
An AbstractSystem
which automatically compiles a straight line program for the fast evaluation of a system F
and its Jacobian. For large systems the compilation can take some time and require a large amount of memory. If this is a problem consider InterpretedSystem
.
CompiledSystem(F::System)
Construct a CompiledSystem
from the given System
F
.
HomotopyContinuation.ModelKit.InterpretedSystem
— TypeInterpretedSystem <: AbstractSystem
An AbstractSystem
which automatically generates a program for the fast evaluation of F
and its Jacobian. The program is however, not compiled but rather interpreted. See also CompiledSystem
.
InterpretedSystem(F::System)
Construct an InterpretedSystem
from the given System
F
.
HomotopyContinuation.MixedSystem
— TypeMixedSystem
A data structure which uses for evaluate!
and evaluate_and_jacobian!
a CompiledSystem
and for taylor!
an InterpretedSystem
.
HomotopyContinuation.fixed
— Methodfixed(F::System; compile::Union{Bool,Symbol} = mixed)
Constructs either a CompiledSystem
(if compile = :all
), an InterpretedSystem
(if compile = :none
) or a MixedSystem
(compile = :mixed
).
It is also possible to set the default compile flag.
HomotopyContinuation.set_default_compile
— Functionset_default_compile(mode::Symbol)
Set the default value for the compile
flag in solve
and other functions. Possible values are :mixed
(default), :all
and :none
.
Interface
An AbstractSystem
needs to implement the following methods:
Base.size(F::AbstractSystem)
ModelKit.variables(F::AbstractSystem)::Vector{Variable}
ModelKit.parameters(F::AbstractSystem) = Variable[]
ModelKit.variable_groups(::AbstractSystem)::Union{Nothing,Vector{Vector{Variable}}} = nothing
# this has to work with x::Vector{Variable}
(F::AbstractSystem)(x, p = nothing)
# this has to work with x::Vector{ComplexF64} and x::Vector{ComplexDF64}
evaluate!(u, F::AbstractSystem, x, p = nothing)
# this has only to work with x::Vector{ComplexF64}
evaluate_and_jacobian!(u, U, F::AbstractSystem, x, p = nothing)
If the system should be used in context of a parameter homotopy it is also necessary to implement
taylor!(u, ::Val{1}, F::AbstractSystem, x, p::TaylorVector{2})
AffineChartSystem
HomotopyContinuation.AffineChartSystem
— TypeAffineChartSystem(F::AbstractSystem, v::PVector{T,N})
Given a system $F(x): (ℙ^{m_1} × ⋯ × ℙ^{m_N}) → ℂⁿ$ this creates a new affine system $F′$ which operates on the affine chart defined by the vector $v ∈ ℙ^{m_1} × ⋯ × ℙ^{m_N}$ and the augmented conditions $vᵀx = 1$.
HomotopyContinuation.on_affine_chart
— Methodon_affine_chart(F::Union{System,AbstractSystem}, dimensions)
Construct an AffineChartSystem
on a randomly generated chart v
. Each entry is drawn idepdently from a univariate normal distribution.
CompositionSystem
HomotopyContinuation.CompositionSystem
— TypeCompositionSystem(G::AbstractSystem, F::AbstractSystem)
Construct the system $G(F(x;p);p)$. Note that the parameters are passed to $G$ and $F$ are identical.
HomotopyContinuation.compose
— Functioncompose(G::Union{AbstractSystem,System}, F::Union{AbstractSystem,System})
Construct the composition $G(F(x))$. You can also use the infix operator ∘
(written by \circ).
Example
julia> @var a b c x y z
julia> g = System([a * b * c]);
julia> f = System([x+y, y + z, x + z]);
julia> compose(g, f)
Composition G ∘ F:
F:
ModelKitSystem{(0xbb16b481c0808501, 1)}:
Compiled: System of length 3
3 variables: x, y, z
x + y
y + z
x + z
G:
ModelKitSystem{(0xf0a2384a42428501, 1)}:
Compiled: System of length 1
3 variables: a, b, c
a*b*c
julia> (g ∘ f)([x,y,z])
1-element Array{Expression,1}:
(x + z)*(y + z)*(x + y)
FixedParameterSystem
HomotopyContinuation.FixedParameterSystem
— TypeFixedParameterSystem(F:AbstractSystem, parameters)
Construct a system from the given AbstractSystem
F
with the given parameters
fixed.
HomotopyContinuation.fix_parameters
— Methodfix_parameters(F::Union{System,AbstractSystem}, p; compile::Union{Bool,Symbol} = mixed)
Fix the parameters of the given system F
. Returns a FixedParameterSystem
.
RandomizedSystem
HomotopyContinuation.RandomizedSystem
— TypeRandomizedSystem(F::Union{System,AbstractSystem}, k::Integer;
identity_block = true,
compile = mixed)
Given a $n × N$ system F
this constructs the system
\mathfrak{R}(F; k)(x) = A⋅F(x)
where
A
is a
k × N
matrix. If
identity_block = truethen the first
kcolumns of
A
` form an identity matrix. The other entries are random complex numbers. See Chapter 13.5 in [SW05] for more details.
RandomizedSystem(F::Union{System,AbstractSystem}, A::Matrix{ComplexF64};
identity_block = true,
compile = mixed)
Explicitly provide the used randomization matrix. If identity = true
then A
has to be k × (n - k)
matrix. Otherwise A
has to be a k × n
matrix..
Real Systems
HomotopyContinuation.is_real
— Functionis_real(r::PathResult; tol::Float64 = 1e-6)
We consider a result as real
if the infinity-norm of the imaginary part of the solution is at most tol
.
is_real(certificate::AbstractSolutionCertificate)
Returns true
if certificate
certifies that the certified solution interval contains a true real zero of the system. If false
is returned then this does not necessarily mean that the true solution is not real.
- SW05Sommese, A. J., & Wampler, C. W. (2005). The Numerical Solution of Systems of Polynomials Arising in Engineering and Science. World Scientific.