DiffKrylov provides a differentiable API for Krylov.jl using ForwardDiff.jl and Enzyme.jl. This is a work in progress and eventually should enable numerical comparisons between discrete and continuous tangent and adjoint methods (see this report).
- Only supports
gmres,cg, andbicgstabmethods - No support for linear operators
- How to set the options for the tangent/adjoint solve based on the options for the forward solve? For example
bicgtabmay returnNaNfor the tangents or adjoints.
] add DiffKrylovUsing ForwardDiff.jl, we can compute the Jacobian of x with respect to b using the ForwardDiff.jl API:
using ForwardDiff, DiffKrylov, Krylov, Random
A = rand(64,64)
b = rand(64)
J = ForwardDiff.jacobian(x -> gmres(A, x)[1], b)