Skip to content

Commit ad13a1d

Browse files
authored
Merge pull request #637 from JuliaHomotopyContinuation/fix-certification-bug
Fix certification bug
2 parents 56ab096 + 9833c19 commit ad13a1d

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

src/certification.jl

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,13 @@ abstract type AbstractSolutionCertificate end
4141
"""
4242
SolutionCertificate
4343
44-
Result of [`certify`](@ref) for a single solution. Contains the initial solutions
45-
and if the certification was successfull a vector of complex intervals where the true
46-
solution is contained in.
44+
Result of [`certify`](@ref) for a single solution. Contains the initial solutions and if the certification was successfull a vector of complex intervals where the true solution is contained in.
45+
The complex intervals are given as an `Arblib.AcbMatrix`.
46+
The `Arblib.AcbMatrix` is printed in the default format of `Arblib`. This means that, if the midpoint of an interval can't be represented with sufficiently many correct digits, `Arblib` will not print the midpoint. Instead, it will print an interval of the form `[+/- r]`, where `r` will be an upper bound for the absolute value of the ball. An enclosure of the correct interval can be printed as follows.
47+
```julia
48+
Base.show(certificate::SolutionCertificate; digits = 16, more = true)
49+
```
50+
This uses the [`ARB_STR_MORE`](https://flintlib.org/doc/arb.html#c.arb_get_str) functionality in `Flint` with `16` digits.
4751
"""
4852
Base.@kwdef struct SolutionCertificate <: AbstractSolutionCertificate
4953
solution_candidate::AbstractVector
@@ -145,8 +149,7 @@ end
145149
certified_solution_interval(certificate::AbstractSolutionCertificate)
146150
147151
Returns an `Arblib.AcbMatrix` representing a vector of complex intervals where a unique
148-
zero of the system is contained in.
149-
Returns `nothing` if `is_certified(certificate)` is `false`.
152+
zero of the system is contained in. Returns `nothing` if `is_certified(certificate)` is `false`.
150153
"""
151154
certified_solution_interval(certificate::AbstractSolutionCertificate) = certificate.I
152155
@deprecate certified_solution(certificate) certified_solution_interval(certificate)
@@ -156,8 +159,7 @@ certified_solution_interval(certificate::AbstractSolutionCertificate) = certific
156159
157160
Returns an `Arblib.AcbMatrix` representing a vector of complex intervals where a unique
158161
zero of the system is contained in.
159-
This is the result of applying the Krawczyk operator to `certified_solution_interval(certificate)`.
160-
Returns `nothing` if `is_certified(certificate)` is `false`.
162+
This is the result of applying the Krawczyk operator to `certified_solution_interval(certificate)`. Returns `nothing` if `is_certified(certificate)` is `false`.
161163
"""
162164
certified_solution_interval_after_krawczyk(certificate::ExtendedSolutionCertificate) =
163165
certificate.I′
@@ -193,7 +195,14 @@ Returns a `NamedTuple` `(x, Y)` with the parameters of the Krawczyk operator fol
193195
"""
194196
krawczyk_operator_parameters(cert::ExtendedSolutionCertificate) = (x = cert.x̃, Y = cert.Y)
195197

196-
function Base.show(f::IO, cert::AbstractSolutionCertificate)
198+
Base.show(cert::AbstractSolutionCertificate; digits::Int = 16, more::Bool = false) =
199+
Base.show(stdout, cert; digits = digits, more = more)
200+
function Base.show(
201+
f::IO,
202+
cert::AbstractSolutionCertificate;
203+
digits::Int = 16,
204+
more::Bool = false,
205+
)
197206
println(f, "SolutionCertificate:")
198207
println(f, "solution_candidate = [")
199208
for z in solution_candidate(cert)
@@ -208,7 +217,7 @@ function Base.show(f::IO, cert::AbstractSolutionCertificate)
208217
println(f, "certified_solution_interval = [")
209218
for z in certified_solution_interval(cert)
210219
print(f, " ")
211-
print(f, z)
220+
print(f, string(z; digits = digits, more = more))
212221
println(f, ",")
213222
end
214223
println(f, "]")

0 commit comments

Comments
 (0)