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}(6.9223801607803e-310,5.0e-324,6.9223432389546e-310,6.9223131348107e-310), Dual{Nothing}(6.9223432389467e-310,6.92238721457254e-310,5.0e-324,6.92234323748743e-310), Dual{Nothing}(6.9223432389404e-310,6.9223129871278e-310,6.92231298781155e-310,6.9223432389404e-310)], ForwardDiff.Dual{Nothing, Float64, 3}[Dual{Nothing}(6.9223432393625e-310,6.922377244063e-310,6.9223921786904e-310,6.9222547144943e-310), Dual{Nothing}(1.93e-322,1.94627e-319,2.130317216e-314,7.746817145885188e-304), Dual{Nothing}(5.0e-324,6.92238443678687e-310,0.0,0.0)])), [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