ForwardDiff.jl
ForwardDiff.jl copied to clipboard
Forward Mode Automatic Differentiation for Julia
I am here to reporting some dubious results from the derivative of a matrix inversion for the diagonal matrix. Package version: [f6369f11] ForwardDiff v0.10.14 `A = [0.5 0 0 ;...
```julia julia> using ForwardDiff: Dual julia> x = Complex(Dual(2, 1.0), Dual(3.0, 0.0)) Dual{Nothing}(2.0,1.0) + Dual{Nothing}(3.0,0.0)*im julia> x^2 ERROR: StackOverflowError: Stacktrace: [1] Complex at ./complex.jl:12 [inlined] (repeats 2 times) [2] float...
It seems like a new method is needed to resolve this special case: ``` julia> ForwardDiff.derivative(x -> ℯ^x, 1/2) ERROR: MethodError: ^(::Irrational{:ℯ}, ::ForwardDiff.Dual{ForwardDiff.Tag{var"#1#2",Float64},Float64,1}) is ambiguous. Candidates: ^(::Irrational{:ℯ}, x::Number) in Base.MathConstants...
When differentiating over a complex sqrt `x0 = 5` `ForwardDiff.derivative(x -> sqrt(1im * x), x0)` a StackOverflowError is encountered. > StackOverflowError: Stacktrace: [1] sqrt(::Complex{ForwardDiff.Dual{ForwardDiff.Tag{##20#21,Int64},Float16,1}}) at ./complex.jl:416 (repeats 80000 times) The...
As far as I understand, if you have a function f:R^n -> R^n, there should be a way to calculate J_f(x) . y (Jacobian of f at point x, multiplied...
I want to provide a sparse matrix to `jacobian!`, see this [thread](https://discourse.julialang.org/t/non-sorted-sparsematrixcsc/37133/17) on Discourse. However, setting zero-valued elements in a sparse matrix is expensive, because one needs to search if...
I get a `StackOverflowError` if I try to differentiate some code with a sparse matrix dependent on the variable and I use backslash with it. MWE: ```julia using SparseArrays, ForwardDiff,...
```julia D(f, x) = ForwardDiff.derivative(f, x) D(1) do x f(y) = (x = x*y) D(f, 1) D(f, 1) end # => 2 ``` The correct answer is 1. This is...
Hi, I use `ForwardDiff.jl` applied to CUDA arrays and I want to vary the number of partials in the dual. I want to seed each entry in the array with...
Is there any way to efficiently use ForwardDiff with functions that operates on vectors and return vectors? Suppose I have a function `f` that operates on a vectors by applying...