JuliaDiff / ForwardDiff.jl

Forward Mode Automatic Differentiation for Julia
Other
892 stars 145 forks source link

Add flexibility in dispatch for `iszero_tuple` #667

Open timholy opened 1 year ago

timholy commented 1 year ago

IntervalArithmetic.jl may abandon support for == among intervals (https://github.com/JuliaIntervals/IntervalArithmetic.jl/pull/571). To support specialization for specific Number subtypes, this makes iszero_tuple into a "trait"-dispatched function, first unwrapping all the way down to the elementary numeric type and then jointly dispatching on that type and the actual tuple. This makes it possible to create an extension in IntervalArithmetic that specializes the implementation to use the new comparison operator . The use of recursive unwrapping enables support for higher-order derivatives.

This doesn't pass tests locally, but neither does master, and the failures look identical.

codecov[bot] commented 1 year ago

Codecov Report

All modified lines are covered by tests :white_check_mark:

Comparison is base (d300209) 89.65% compared to head (a0d23e7) 86.54%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #667 +/- ## ========================================== - Coverage 89.65% 86.54% -3.12% ========================================== Files 11 10 -1 Lines 967 899 -68 ========================================== - Hits 867 778 -89 - Misses 100 121 +21 ``` | [Files](https://app.codecov.io/gh/JuliaDiff/ForwardDiff.jl/pull/667?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaDiff) | Coverage Δ | | |---|---|---| | [src/dual.jl](https://app.codecov.io/gh/JuliaDiff/ForwardDiff.jl/pull/667?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaDiff#diff-c3JjL2R1YWwuamw=) | `78.28% <100.00%> (-3.87%)` | :arrow_down: | | [src/partials.jl](https://app.codecov.io/gh/JuliaDiff/ForwardDiff.jl/pull/667?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaDiff#diff-c3JjL3BhcnRpYWxzLmps) | `84.21% <100.00%> (ø)` | | ... and [8 files with indirect coverage changes](https://app.codecov.io/gh/JuliaDiff/ForwardDiff.jl/pull/667/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaDiff)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.