Jacobians
The supertype Jacobian comprises different ways of taking Jacobians:
We first start by showing JacobianAutodiff:
# the input and output dimensions of this function are the same
F(y::AbstractArray, x::AbstractArray, params) = y .= tanh.(x)
dim = 3
x = rand(dim)
jac = JacobianAutodiff{eltype(x)}(F, dim)JacobianAutodiff{Float64, typeof(Main.F), ForwardDiff.JacobianConfig{Nothing, Float64, 3, Tuple{Vector{ForwardDiff.Dual{Nothing, Float64, 3}}, Vector{ForwardDiff.Dual{Nothing, Float64, 3}}}}, Vector{Float64}}(Main.F, ForwardDiff.JacobianConfig{Nothing, Float64, 3, Tuple{Vector{ForwardDiff.Dual{Nothing, Float64, 3}}, Vector{ForwardDiff.Dual{Nothing, Float64, 3}}}}((Partials(1.0, 0.0, 0.0), Partials(0.0, 1.0, 0.0), Partials(0.0, 0.0, 1.0)), (ForwardDiff.Dual{Nothing, Float64, 3}[Dual{Nothing}(5.0e-324,1.0e-323,6.8987005764737e-310,6.8987005764753e-310), Dual{Nothing}(0.0,0.0,0.0,0.0), Dual{Nothing}(0.0,0.0,0.0,0.0)], ForwardDiff.Dual{Nothing, Float64, 3}[Dual{Nothing}(5.0e-324,2.5e-323,6.89870057253382e-310,6.8987005725354e-310), Dual{Nothing}(1.0e-323,1.0e-323,6.8987005693038e-310,6.8987005693054e-310), Dual{Nothing}(1.0e-323,1.0e-323,6.89870056931173e-310,6.8987005693133e-310)])), [0.0, 0.0, 0.0])And the functor:
j = zeros(3, 3)
jac(j, x, nothing)3×3 Matrix{Float64}:
0.770907 0.0 0.0
0.0 0.721643 0.0
0.0 0.0 0.493302