`min` does not return the minimum with respect to `isless` when values tie
Maintainer antworten meist innerhalb von 1 Tag
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 55/100
Rechercherichtung
Start by reading the min implementation and its tests, then compare its tie handling with isless as changed in #695. Reproduce the reported min(x, 48.0) and min(48.0, x) results with ForwardDiff.Dual; done means tied values are selected consistently with isless, independent of argument order, and the regression is covered by a test.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
min is documented to "return the minimum of the arguments, with respect to isless", but for a Dual that ties in value it returns whichever argument comes first:
julia> using ForwardDiff
julia> x = ForwardDiff.Dual(48.0, 1.0);
julia> isless(48.0, x)
true
julia> min(x, 48.0)
Dual{Nothing}(48.0,1.0)
julia> min(48.0, x)
Dual{Nothing}(48.0,0.0)
Since #695, isless breaks a value tie on the partials, so 48.0 is the smaller argument here, but min(x, 48.0) returns x. min picks its argument by value only, so on a tie the result depends on argument order rather than on isless.
I ran into this through differentiating Interpolations.jl, whose linear extrapolation clamps with min and then bounds-checks the result with <=, so it throws a BoundsError under --check-bounds=yes when differentiating exactly at the last knot.
ForwardDiff 1.4.6, Julia 1.12.7.
- Vorherrschende Sprache
- Julia
- Sterne
- 1k
- Forks
- 165
- Ø Merge
- 6 Std. 34 Min.
- Gemergte PRs (30 T.)
- 1
Entwicklungsumgebung
Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus JuliaDiff/ForwardDiff.jl
-
missing floatmin, floatmax, and issubnormal for DualEvtl. vergeben @devmotion hat das vor 29 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
JuliaDiff/ForwardDiff.jl#852 · 6 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
Third-order derivatives of `x / y` are `Inf` or `NaN` for small `y`, e.g. in gradients of Laplace approximationsEvtl. vergeben @devmotion hat das vor 4 Tagen übernommen. Offen
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 65/100
JuliaDiff/ForwardDiff.jl#866 ·
Maintainer antworten meist innerhalb von 1 Tag
-
`fma` and `muladd` ignore NaN-safe modeEvtl. vergeben @devmotion hat das vor 15 Tagen übernommen. Offen
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 55/100
JuliaDiff/ForwardDiff.jl#860 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Enable NaN-safe mode by defaultEvtl. vergeben @devmotion hat das vor 17 Tagen übernommen. Offen
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 25/100
JuliaDiff/ForwardDiff.jl#857 · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 52/100
JuliaDiff/ForwardDiff.jl#854 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in JuliaDiff/ForwardDiff.jl
Ähnliche Issues
-
mul! with a Symmetric or Hermitian factor throws for a matrix view whose columns are not contiguousOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
JuliaLang/LinearAlgebra.jl#1829 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
MagneticResonanceImaging/MRIReco.jl#320 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
rfordatascience/tidytuesday#1098 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
ClapeyronThermo/Clapeyron.jl#662 · 2 Kommentare ·
-
ci system:windows test
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 76/100
Maintainer antworten meist innerhalb von 1 Tag