Matrix Free transpose jacobian using AD

Hi,

I would like to evaluate the transpose of the jacobian of a function F using ForwardDiff.jl or any AD. Is it possible? I read that reverse mode would provide this but failed to achieve this using ReverseDiff.jl.

I know I can evaluate the matrix-free jacobian using ForwardDiff.derivative(t -> F(x .+ t .* dx), 0.)

Thank you for your suggestions,

Best regards

There is ForwardDiff.jacobian.

julia> ForwardDiff.jacobian(identity, zeros(2))
2×2 Array{Float64,2}:
 1.0  0.0
 0.0  1.0
1 Like

Reverse diff is indeed the way to go if you don’t want to form the whole matrix. Try Zygote.

Sorry I cannot form the jacobian as it is way to big. I just want its action on a vector

I was hoping for a simple example, do you know how to do it?

You mean (f, x, v) -> Tracker.gradient(x -> dot(v, f(x)), x)? This is equal to the transpose of the Jacobian of f at x multiplied by v.

1 Like

Thank you!

No worries :slight_smile: