ForwardDiff.jl
ForwardDiff.jl copied to clipboard
Forward Mode Automatic Differentiation for Julia
Currently, `one` returns a `Dual` number. It seems like it could simply return the underlying value type instead. i.e. change [these lines](https://github.com/JuliaDiff/ForwardDiff.jl/blob/4b143a199f541e7c1248dc5bc29b397be938e81d/src/dual.jl#L356-L357) to ```jl Base.one(d::Dual) = one(typeof(d)) Base.oneunit(d::Dual) = oneunit(typeof(d))...
in particular, this code seems really weird: https://github.com/JuliaDiff/ForwardDiff.jl/blob/226374984ec70b96c89053640b267a5c5543781d/src/dual.jl#L463-L477 in particular because `NaNMath` is loaded beforehand: https://github.com/JuliaDiff/ForwardDiff.jl/blob/226374984ec70b96c89053640b267a5c5543781d/src/ForwardDiff.jl#L10 The same thing can be said about `SpecialFunctions`. I noticed that `DiffRules` also depends...
Differentiation with modulo function yields a Float, even for Rational input. What doesn't work: ``` ForwardDiff.derivative(x->mod(x^2,1), 1//3) 0.6666666666666666 ``` What works: ``` ForwardDiff.derivative(x->x^2, 1//3) 2//3 mod(1//2,1) 1//2 ```
Hi, the code in the linked repository gives slightly different optimization results on an Intel machine vs an AMD machine when using ForwardDiff. It does not matter if the operating...
I have a weird case where a complex power is giving me an inexact error because the `_cpow `helper function determines my object to be an integer. Truncated error message:...
These were removed in https://github.com/JuliaDiff/ForwardDiff.jl/pull/472 and while I was a bit uncomfortable with it I did not protest. However, now after doing some benchmarks I see that this has a...
The result is correct only if I tag the matrix to be symmetric. ```julia using LinearAlgebra using ForwardDiff function f_backward(x1, x2, rho) cov = [ 1.0 rho; rho 1.0 ]...
Considering these two methods that compute the value and first derivative of a scalar function in a single pass: ```jl import ForwardDiff import DiffResults @inline function value_and_derivative(f, Y::Type, x::Real) diffresult...
Excellent package! Is there a way to get the function value and its derivative in one call? Thanks.
There are already a few issues talking about #481 (#606, #607) and related problems (#480). I've been running into breakage hinted at in [this comment](https://github.com/JuliaDiff/ForwardDiff.jl/pull/481#issuecomment-1171251680) and [this workaround](https://github.com/JuliaDiff/ForwardDiff.jl/issues/607#issuecomment-1314299091) where ```jl...