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.90706366619954e-310,6.9070636662011e-310), Dual{Nothing}(1.5e-323,1.5e-323,6.9070636662027e-310,6.9070636662043e-310), Dual{Nothing}(2.0e-323,4.4e-323,6.90706366620586e-310,6.90706366620744e-310)], ForwardDiff.Dual{Nothing, Float64, 3}[Dual{Nothing}(5.0e-324,1.0e-323,6.9070636692335e-310,6.90706366923508e-310), Dual{Nothing}(1.5e-323,1.5e-323,6.90706366923824e-310,6.9070636692398e-310), Dual{Nothing}(2.0e-323,4.4e-323,6.907063669243e-310,6.90706366924456e-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