Repository navigation
ForwardDiff with Interval partials - #769
Conversation
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #769 +/- ##
==========================================
- Coverage 75.48% 75.35% -0.14%
==========================================
Files 32 32
Lines 3100 3112 +12
==========================================
+ Hits 2340 2345 +5
- Misses 760 767 +7 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
I am not sure in what context |
|
For the rest of the extension, the strategy has been to reimplement the short-circuiting behaviors, removing the short circuit altogether (that's why there is a version of This was a conscious choice: we unfortunately do not have a function testing if "this value can be discarded for the purpose of addition" (which is how ForwardDiff uses Therefore, if it is a reasonable amount of work, I would keep de-short-circuiting ForwardDiff for now. Finding a more general solution would be great, but it probably requires a deep discussion with the ForwardDiff team. |
Add power methods with decidable thin-zero checks for interval-valued partials. Support real, interval, and exact exponents through four nested Dual layers. Assisted-by: Claude Fable 5 <noreply@anthropic.com>
|
Sorry for the delay. The new version follows @Kolaru's recommended design. |
Benchmark Results (Julia v1)Time benchmarks
Memory benchmarks
|
Resolves the two modify/delete conflicts: `test/interval_tests/display.jl` and `test/interval_tests/forwarddiff.jl` are deleted by this branch, and the assertions they gained in JuliaIntervals#777 and JuliaIntervals#769 are carried over into the new test layout by the following commits.
…s#777 and JuliaIntervals#769 This branch was written against the tree before JuliaIntervals#777, so several assertions pinned the behavior that JuliaIntervals#777 fixed, and the regression tests its commit messages defer to "the test-suite rework" were partly missing. The ones that pinned the old behavior are updated: - `display.jl`: the midpoint format of `interval(-floatmin(Float64), 1.3)` and its `Float32`/`Float16` counterparts, now that the radius is rounded upward (`0.65 ± 0.650001`, `Float16(0.6504)`); - `boolean.jl`: `isnai` on a complex interval with a single NaI component is now `true`, consistent with `isnan`; - `cancellative.jl`: `cancelminus` works for `Rational` bounds (corner case 1 is a finite-precision artifact and is skipped there) and no longer emits the spurious "interval part of NaI" warning; - `extended_div.jl`: mixed bound types promote instead of throwing; - `numeric.jl`: `mid(x, α)` of a half-unbounded interval takes `α` into account, so the finite bound is reachable; - `set_operations.jl`: `_interiordiff` keeps the boundary point of a shared endpoint, and `interval_diff` builds its pieces with the internal constructor (`trv` at best, guarantee propagated rather than upgraded). The regression tests that were missing are added: - `radius`/`midradius` enclosure: the previous check used three intervals that all pass with the round-to-nearest radius, so it could not catch the bug; it is replaced by the documented `mid(x) ± radius(x)` containment on the counterexample of JuliaIntervals#777 plus a seeded sweep of 10^4 intervals (which fails on roughly half of them without the fix); - `dist` for intervals sharing an infinite endpoint, including the `Rational` case that used to throw a `DivideError`; - `mince`/`mince!` monotonicity, shared endpoints and output resizing; - `intersect_interval` with `dec = :auto` on an empty result, which must clamp to `trv` rather than return an invalid `∅_com`; - `mag`/`mig` of complex intervals with an empty component; - `isstrictsubset` of a real interval in a complex one with equal real parts; - `isdisjoint_interval` NaI guards on the mixed Complex/Interval methods; - `mid` of unbounded `Rational{BigInt}` intervals, which throws an informative `ArgumentError` where the float clamps have no counterpart. The interval partials tests of JuliaIntervals#769 are ported from the deleted `test/interval_tests/forwarddiff.jl` into the extension test file, and the tuple-vs-tuple `rightof`/`leftof` of `Piecewise` gain direct tests, since only their use through `intersect_domain` was covered. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This change supports differentiation of functions with interval-valued partials, like
Previously, those failed due to a short-circuit in ForwardDiff, triggering
This short-circuits the short-circuit, by specializing
Base.iszeroon Interval-containingForwardDiff.DualandForwardDiff.Partials. No behavior change in IntervalArithmetic itself is needed.