Skip to content

More beautiful display of :unknown #247

Open
Kolaru wants to merge 2 commits into
JuliaIntervals:masterfrom
Kolaru:reasonnable_display
Open

More beautiful display of :unknown #247
Kolaru wants to merge 2 commits into
JuliaIntervals:masterfrom
Kolaru:reasonnable_display

Conversation

@Kolaru
Copy link
Copy Markdown
Member

@Kolaru Kolaru commented May 15, 2026

As discussed in the JuliaInterval call, this PR reintroduces showing more information for :unknown roots in vectors, with fancy connector to group the information.

However, this information is still hidden if the IOContext is :compact, like for matrices:

julia> f(x) = (x < 1) ? x : (x - 2)^2 * (x - 3)
f (generic function with 1 method)

julia> rts = roots(f, interval(-5, 5))
4-element Vector{Root{Interval{Float64}}}:
 Root([0.0, 0.0]_com, :unique)
 Root([1.0, 1.0]_com, :unknown)
 ├ Not converged: region size smaller than the tolerance
 ├ Warning: error encountered during computation (use showerror(root.error) to see the whole stacktrace)
 └ InconclusiveBooleanOperation: The operation `[1.0, 1.0]_com < [1.0, 1.0]_com_NG` cannot be determined unambiguously. See the documentation for more information. See also `strictprecedes`.
 Root([2.0, 2.0]_com_NG, :unknown)
 └ Not converged: region size smaller than the tolerance
 Root([3.0, 3.0]_com_NG, :unique)

julia> reshape(rts, 2, 2)
2×2 Matrix{Root{Interval{Float64}}}:
 Root([0.0, 0.0]_com, :unique)   Root([2.0, 2.0]_com_NG, :unknown)
 Root([1.0, 1.0]_com, :unknown)  Root([3.0, 3.0]_com_NG, :unique)

@dpsanders @OlivierHnt

@github-actions
Copy link
Copy Markdown
Contributor

Benchmark Results

master 48f0a82... master / 48f0a82...
10 dimensional/IntervalRootFinding.Krawczyk 3.14 ± 0.037 s 3.15 ± 0.033 s 0.998 ± 0.016
10 dimensional/IntervalRootFinding.Newton 48.5 s 48.1 s 1.01
Dietmar-Ratz/Dietmar-Ratz 1/IntervalRootFinding.Krawczyk 3.61 ± 0.091 μs 3.63 ± 0.21 μs 0.994 ± 0.063
Dietmar-Ratz/Dietmar-Ratz 1/IntervalRootFinding.Newton 3.65 ± 0.1 μs 3.6 ± 0.13 μs 1.01 ± 0.046
Dietmar-Ratz/Dietmar-Ratz 2/IntervalRootFinding.Krawczyk 0.106 ± 0.0011 ms 0.102 ± 0.0013 ms 1.03 ± 0.017
Dietmar-Ratz/Dietmar-Ratz 2/IntervalRootFinding.Newton 0.248 ± 0.011 ms 0.241 ± 0.013 ms 1.03 ± 0.074
Dietmar-Ratz/Dietmar-Ratz 3/IntervalRootFinding.Krawczyk 0.262 ± 0.014 ms 0.252 ± 0.014 ms 1.04 ± 0.078
Dietmar-Ratz/Dietmar-Ratz 3/IntervalRootFinding.Newton 0.186 ± 0.01 ms 0.181 ± 0.013 ms 1.03 ± 0.092
Dietmar-Ratz/Dietmar-Ratz 4/IntervalRootFinding.Krawczyk 0.0544 ± 0.00072 ms 0.0508 ± 0.00074 ms 1.07 ± 0.021
Dietmar-Ratz/Dietmar-Ratz 4/IntervalRootFinding.Newton 0.0351 ± 0.00078 ms 0.0341 ± 0.0022 ms 1.03 ± 0.071
Dietmar-Ratz/Dietmar-Ratz 5/IntervalRootFinding.Krawczyk 3.5 ± 0.1 μs 3.46 ± 0.11 μs 1.01 ± 0.044
Dietmar-Ratz/Dietmar-Ratz 5/IntervalRootFinding.Newton 3.45 ± 0.1 μs 3.44 ± 0.099 μs 1 ± 0.041
Dietmar-Ratz/Dietmar-Ratz 6/IntervalRootFinding.Krawczyk 13.6 ± 0.25 μs 13.5 ± 0.86 μs 1.01 ± 0.068
Dietmar-Ratz/Dietmar-Ratz 6/IntervalRootFinding.Newton 20.6 ± 0.58 μs 20 ± 0.46 μs 1.03 ± 0.037
Dietmar-Ratz/Dietmar-Ratz 7/IntervalRootFinding.Krawczyk 3.71 ± 0.09 μs 3.73 ± 0.13 μs 0.995 ± 0.042
Dietmar-Ratz/Dietmar-Ratz 7/IntervalRootFinding.Newton 3.71 ± 0.1 μs 3.73 ± 0.12 μs 0.995 ± 0.042
Dietmar-Ratz/Dietmar-Ratz 9/IntervalRootFinding.Krawczyk 4.02 ± 0.099 μs 4.03 ± 0.13 μs 0.998 ± 0.041
Dietmar-Ratz/Dietmar-Ratz 9/IntervalRootFinding.Newton 4.01 ± 0.099 μs 4.06 ± 0.13 μs 0.987 ± 0.04
Rastigrin stationary points/IntervalRootFinding.Krawczyk 0.151 ± 0.0042 s 0.15 ± 0.001 s 1 ± 0.029
Rastigrin stationary points/IntervalRootFinding.Newton 0.143 ± 0.0019 s 0.142 ± 0.0019 s 1.01 ± 0.018
Smiley/Smiley and Chun (2001), Example 2.2/IntervalRootFinding.Krawczyk 2.78 ± 0.058 ms 2.74 ± 0.052 ms 1.01 ± 0.029
Smiley/Smiley and Chun (2001), Example 2.2/IntervalRootFinding.Newton 2.2 ± 0.037 ms 2.13 ± 0.031 ms 1.03 ± 0.023
Smiley/Smiley and Chun (2001), Example 5.2/IntervalRootFinding.Krawczyk 0.0381 ± 0.0036 s 0.0376 ± 0.0036 s 1.01 ± 0.14
Smiley/Smiley and Chun (2001), Example 5.2/IntervalRootFinding.Newton 0.0322 ± 0.0033 s 0.0317 ± 0.0031 s 1.01 ± 0.14
Smiley/Smiley and Chun (2001), Example 5.4/IntervalRootFinding.Krawczyk 1.83 ± 0.03 ms 1.98 ± 0.033 ms 0.924 ± 0.022
Smiley/Smiley and Chun (2001), Example 5.4/IntervalRootFinding.Newton 1.82 ± 0.026 ms 1.81 ± 0.026 ms 1.01 ± 0.021
Smiley/Smiley and Chun (2001), Example 5.5/IntervalRootFinding.Krawczyk 5.67 s 5.55 s 1.02
Smiley/Smiley and Chun (2001), Example 5.5/IntervalRootFinding.Newton 5.21 s 5.09 s 1.03
time_to_load 0.406 ± 0.0062 s 0.4 ± 0.00075 s 1.02 ± 0.016

Benchmark Plots

A plot of the benchmark results have been uploaded as an artifact to the workflow run for this PR.
Go to "Actions"->"Benchmark a pull request"->[the most recent run]->"Artifacts" (at the bottom).

@OlivierHnt
Copy link
Copy Markdown
Member

Really nice! There are only a few doctests to fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants