There are some discussions how to compute the Jacobian-vector product J_f(x) * y for a function f efficiently with ForwardDiff.jl, e.g., Calculating J_f(x) . y efficiently · Issue #319 · JuliaDiff/ForwardDiff.jl · GitHub
I have a use case where I would like to use the value f(x) for the vector y. Using the approach described there, I basically need to compute f(x) first and then the Jacobian-vector product J_f(x) * f(x). However, the latter will also compute f(x) as part of the expression, of course.
Does anybody know a more efficient way to compute the special Jacobian-vector product J_f(x) * f(x) using ForwardDiff.jl?