DiffKrylov.jl

Author JuliaSmoothOptimizers
Popularity
9 Stars
Updated Last
7 Months Ago
Started In
December 2023

DiffKrylov

CI

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).

Current Technical Limitations

  • Only supports gmres, cg, and bicgstab methods
  • No support for linear operators

Current Open Questions

  • How to set the options for the tangent/adjoint solve based on the options for the forward solve? For example bicgtab may return NaN for the tangents or adjoints.

Installation

] add DiffKrylov

Usage

Using 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)