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.94578438593945e-310,6.9457929313206e-310,6.9457929317862e-310,6.9457518344635e-310), Dual{Nothing}(1.3528e-320,1.9466e-319,7.748597204865894e-304,7.746817145885187e-304), Dual{Nothing}(5.0e-324,6.945788661946e-310,0.0,6.9457518344564e-310)], ForwardDiff.Dual{Nothing, Float64, 3}[Dual{Nothing}(6.94578438593945e-310,5.0e-324,6.94574800631324e-310,6.9457167680966e-310), Dual{Nothing}(6.9457929024561e-310,6.9457903856438e-310,6.94574882201567e-310,6.94574800612826e-310), Dual{Nothing}(6.94574800628794e-310,6.9457477069103e-310,6.94574770904224e-310,6.94574800628794e-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