Results
A call to solve
returns a Result
:
HomotopyContinuation.Result
— TypeResult
The result of solve
. This is a wrapper around the results of each single path (PathResult
) and it contains some additional information like a random seed to replicate the result.
HomotopyContinuation.seed
— Methodseed(::Result)
Returns the seed to replicate the result.
HomotopyContinuation.path_results
— Methodpath_results(::Result)
Returns the stored PathResult
s.
Filtering results and solutions
HomotopyContinuation.results
— Functionresults(
result;
only_real = false,
real_atol = 1e-6,
real_rtol = 0.0,
only_nonsingular = false,
only_singular = false,
only_finite = true,
multiple_results = false,
)
results(f, result; options...)
Return all PathResult
s for which satisfy the given conditions and apply, if provided, the function f
.
real_tol
is a deprecated alias for real_atol
and will be removed in a future version. For backwards compatibility, setting real_tol
overrides real_atol
, but users should switch now to using real_atol
directly.
results(result::MonodromyResult)
Returns the computed PathResult
s.
results(W::WitnessSet)
Get the results stored in W
.
HomotopyContinuation.solutions
— Functionsolutions(result; only_nonsingular = true, conditions...)
Returns all solutions for which the given conditions apply, see results
for the possible conditions.
Example
julia> @var x y
julia> F = System([(x-2)y, y+x+3]);
julia> solutions(solve(F))
2-element Array{Array{Complex{Float64},1},1}:
[2.0 + 0.0im, -5.0 + 0.0im]
[-3.0 + 0.0im, 0.0 + 0.0im]
solutions(result::MonodromyResult)
Return all solutions.
solutions(W::WitnessSet)
Get the solutions stored in W
.
solutions(d::DistinctCertifiedSolutions)
Return a vector of solutions in the DistinctSolutionCertificates object.
Base.real
— Methodreal(result; kwargs...)
Get all results where the solutions are real with the given tolerance tol
. See is_real
for details regarding how kwargs
affect the determination of 'realness'.
HomotopyContinuation.real_solutions
— Functionreal_solutions(result; atol=1e-6, rtol = 0.0, conditions...)
Return all real solution for which the given conditions apply. For the possible conditions
see results
. Note that only_real
is always true
, real_atol
is now atol
and real_rtol
is now rtol
.
Example
julia> @var x y;
julia> F = System([(x-2)y, y+x+3]);
julia> real_solutions(solve(F))
2-element Array{Array{Float64,1},1}:
[2.0, -5.0]
[-3.0, 0.0]
The tol
keyword argument is deprecated and will be removed in a future version. Use atol
instead. For backwards compatibility, setting tol
overrides atol
, but users should switch now to using atol
directly.
HomotopyContinuation.nonsingular
— Functionnonsingular(result; conditions...)
Return all PathResult
s for which the solution is non-singular. This is just a shorthand for results(R; only_nonsingular=true, conditions...)
. For the possible conditions
see results
.
HomotopyContinuation.singular
— Functionsingular(result; multiple_results=false, kwargs...)
Return all [PathResult
]s for which the solution is singular. If multiple_results=false
only one point from each cluster of multiple solutions is returned. If multiple_results = true
all singular solutions in R
are returned. For the possible kwargs
see results
.
HomotopyContinuation.at_infinity
— Functionat_infinity(result)
Get all results where the solutions is at infinity.
HomotopyContinuation.failed
— Functionfailed(result)
Get all results where the path tracking failed.
Counting
HomotopyContinuation.nresults
— Functionnresults(
result;
only_real = false,
real_atol = 1e-6,
real_rtol = 0.0,
only_nonsingular = false,
only_singular = false,
only_finite = true,
multiple_results = false,
)
Count the number of results which satisfy the corresponding conditions. See also results
.
real_tol
is a deprecated alias for real_atol
and will be removed in a future version. For backwards compatibility, setting real_tol
overrides real_atol
, but users should switch now to using real_atol
directly.
nresults(result::MonodromyResult)
Returns the number of results computed.
HomotopyContinuation.nsolutions
— Functionnsolutions(result; only_nonsingular = true, options...)
The number of solutions. See results
for the possible options.
nsolutions(result::MonodromyResult)
Returns the number solutions of the result
.
HomotopyContinuation.nreal
— Functionnreal(result; kwargs...)
The number of real solutions. See also is_real
.
HomotopyContinuation.nnonsingular
— Functionnnonsingular(result)
The number of non-singular solutions. See also is_singular
.
HomotopyContinuation.nsingular
— Functionnsingular(
result;
counting_multiplicities = false,
kwargs...,
)
The number of singular solutions. A solution is considered singular if its winding number is larger than 1 or the condition number is larger than tol
. If counting_multiplicities=true
the number of singular solutions times their multiplicities is returned.
HomotopyContinuation.nat_infinity
— Functionnat_infinity(result)
The number of solutions at infinity.
HomotopyContinuation.nexcess_solutions
— Functionnexcess_solutions(result)
The number of exess solutions. See also excess_solution_check
.
HomotopyContinuation.nfailed
— Functionnfailed(result)
The number of failed paths.
PathResult
HomotopyContinuation.PathResult
— TypePathResult
A PathResult
is the result of tracking of a path with track
using an AbstractPathTracker
( e.g. EndgameTracker
)
Fields
General solution information:
return_code
: See the list of return codes below.solution::V
: The solution vector.t::Float64
: The value oft
at whichsolution
was computed. Note that ifreturn_code
is:at_infinity
, thent
is the value when this was decided.accuracy::Float64
: An estimate the (relative) accuracy of the computed solution.residual::Float64
: The infinity norm ofH(solution,t)
.condition_jacobian::Float64
: This is the condition number of the Jacobian at the solution. A high condition number indicates a singular solution or a solution on a positive dimensional component.singular::Bool
: Whether the solution is considered singular.winding_number:Union{Nothing, Int}
: The computed winding number. This is a lower bound on the multiplicity of the solution. It is $nothing$ if the Cauchy endgame was not used.extended_precision::Bool
: Indicate whether extended precision is necessary to achieve the accuracy of thesolution
.path_number::Union{Nothing,Int}
: The number of the path (optional).start_solution::Union{Nothing,V}
: The start solution of the path (optional).
Performance information:
accepted_steps::Int
: The number of accepted steps during the path tracking.rejected_steps::Int
: The number of rejected steps during the path tracking.extended_precision_used::Bool
: Indicates whether extended precision was necessary to track the path.
Additional path and solution informations
valuation::Vector{Float64}
: An approximation of the valuation of the Puiseux series expansion of $x(t)$.last_path_point::Tuple{V,Float64}
: The last pair $(x,t)$ before the solution was computed. If the solution was computed with the Cauchy endgame, then the pair $(x,t)$ can be used to rerun the endgame.
Return codes
Possible return codes are:
:success
: TheEndgameTracker
obtained a solution.:at_infinity
: TheEndgameTracker
stopped the tracking of the path since it determined that that path is diverging towards infinity.:at_zero
: TheEndgameTracker
stopped the tracking of the path since it determined that that path has a solution where at least one coordinate is 0. This only happens if the optionzero_is_at_infinity
istrue
.:excess_solution
: For the solution of the system, the system had to be modified which introduced artificial solutions and this solution is one of them.- various return codes indicating termination of the tracking
HomotopyContinuation.solution
— Methodsolution(r::PathResult)
Get the solution of the path.
HomotopyContinuation.is_success
— Methodis_success(r::PathResult)
Checks whether the path is successfull.
HomotopyContinuation.is_at_infinity
— Methodis_at_infinity(r::PathResult)
Checks whether the path goes to infinity.
HomotopyContinuation.is_excess_solution
— Methodis_excess_solution(r::PathResult)
Checks whether gives an excess solution that was artificially introduced by the homotopy continuation from the modified system.
HomotopyContinuation.is_failed
— Methodis_failed(r::PathResult)
Checks whether the path failed.
HomotopyContinuation.is_finite
— Methodis_finite(r::PathResult)
Checks whether the path result is finite.
HomotopyContinuation.is_singular
— Methodis_singular(r::PathResult)
Checks whether the path result r
is singular.
HomotopyContinuation.is_nonsingular
— Methodis_nonsingular(r::PathResult)
Checks whether the path result is non-singular. This is true if it is not singular.
HomotopyContinuation.is_real
— Methodis_real(r::PathResult; atol::Float64 = 1e-6, rtol::Float64 = 0.0)
We consider a result as real
if either:
- the infinity-norm of the imaginary part of the solution is less than
atol
- the infinity-norm of the imaginary part of the solution is less than
rtol * norm(s, 1)
, where s is the solution inPathResult
.
tol
is a deprecated alias for atol
and will be removed in a future version. For backwards compatibility, setting tol
overrides atol
, but users should switch now to using atol
directly.
HomotopyContinuation.accuracy
— Methodaccuracy(r::PathResult)
Get the accuracy of the solution. This is an estimate of the (relative) distance to the true solution.
HomotopyContinuation.residual
— Methodresidual(r::PathResult)
Get the residual of the solution.
HomotopyContinuation.steps
— Methodsteps(r::PathResult)
Total number of steps the path tracker performed.
HomotopyContinuation.accepted_steps
— Methodaccepted_steps(r::PathResult)
Total number of steps the path tracker accepted.
HomotopyContinuation.rejected_steps
— Methodrejected_steps(r::PathResult)
Total number of steps the path tracker rejected.
HomotopyContinuation.winding_number
— Methodwinding_number(r::PathResult)
Get the winding number of the solution of the path. Returns nothing
if it wasn't computed.
HomotopyContinuation.path_number
— Methodpath_number(r::PathResult)
Get the number of the path. Returns nothing
if it wasn't provided.
HomotopyContinuation.start_solution
— Methodstart_solution(r::PathResult)
Get the start solution of the path.
HomotopyContinuation.multiplicity
— Methodmultiplicity(r::PathResult)
Get the multiplicity of the solution of the path.
HomotopyContinuation.last_path_point
— Methodlast_path_point(r::PathResult)
Returns a tuple (x,t)
containing the last zero of H(x, t)
before the Cauchy endgame was used. Returns nothing
if the endgame strategy was not invoked.
HomotopyContinuation.valuation
— Methodvaluation(r::PathResult)
Get the computed valuation of the path.
ResultIterators
HomotopyContinuation.ResultIterator
— TypeResultIterator{Iter} <: AbstractResult
A struct which represents a result. Its fields are
starts
: An iterator over the start solutions of a solver.S
: The solver which was used to compute the results.bitmask
(optional): ABitVector
which is used to filter the results.
It is an iterator over the start solutions of a solver, which may also be passed as an iterator. Objects of this type can be treated just like a Result
object, i.e. you can iterate over it, get the length, etc. The distinction is that it does not store the results but rather computes them on-the-fly when iterated over. This is useful for large sets of results or when you want to apply a filter to the results without storing them all in memory.
Example
julia> @var x y a[1:6];
julia> F = System(
[
(a[1] * x^2 + a[2] * y) * (a[3] * x + a[4] * y) + 1,
(a[1] * x^2 + a[2] * y) * (a[5] * x + a[6] * y) + 1,
];
parameters = a,
)
julia> P = randn(ComplexF64,6)
julia> res = solve(
F;
iterator_only = true,
target_parameters = P,
)
ResultIterator
==============
• start solutions: PolyhedralStartSolutionsIterator
• homotopy: Polyhedral
You may collect res
to obtain the results. Doing so actually tracks the paths.
collect(res)
Now, res
may be passed along to solve
as a set of start solutions.
solve(F, res;
iterator_only = true,
target_parameters = randn(ComplexF64,6)
)
HomotopyContinuation.bitmask_filter
— Functionbitmask_filter(f::Function, ri::ResultIterator)
Given a boolean valued function f
and a ResultIterator
ri
, this function returns a new ResultIterator
which represents the results for which f
returns true
. It does this by iterating through ri
and applying f
to each result to create a BitVector
that serves to cache the results of f
for each solution in ri
.
julia> @var x y;
julia> F = System([x^3 + y^3 - 1, x + y - 1])
julia> res = solve(F; iterator_only = true)
julia> bm = bitmask_filter(is_real, res)
ResultIterator
==============
• start solutions: PolyhedralStartSolutionsIterator
• homotopy: Polyhedral
• filtering bitmask
HomotopyContinuation.trace
— Functiontrace(ri::ResultIterator)
This function computes the coordinate-wise sum, or trace, of the solutions in a ResultIterator
by iterating through the solutions and summing them up one at a time.
julia> @var x y;
julia> F = System([x^3 + y^3 - 1, x + y - 1])
julia> res = solve(F; iterator_only = true)
julia> tr = trace(res)
2-element Vector{ComplexF64}:
1.0 + 0.0im
1.0 + 0.0im
trace(result::MonodromyResult)
Return the result of the trace test computed during the monodromy.