# Complex differentiation of linear solvers

I have a linear system $$Ax=b$$ which I'm solving approximately, and I need to take the frechet derivative of x with respect to z. Were I solving the problem exactly (either analytically or to machine 0) I'd simply say $$\frac{dx}{dz}\vec{v} = \frac{d A^{-1}b}{dz}\vec{v} = \left(\frac{dA}{dz}A^{-1}\frac{dA}{dz}b + A^{-1}\frac{db}{dz}\right)\vec{v}$$ Since I am not solving the system exactly (2 orders of accuracy say), I thought the best way to get the sensitivity, would be a complex perturbation to the linear system. I.e, solve the linear system, but where it is: $$A(z+i\epsilon {v})x = b(z+i\epsilon\vec{v})$$ And I could then take the imaginary part of x. Will this work the way I want it to? Then if I wanted the adjoint differentiation, of the linear solve, would I give a complex perturbation to the matrix and transpose it?

This is related to my previous question posted here: Derivatives of Approximate Matrix inverses

• It would be useful to have more detail on how you are actually solving the system. The value of the derivative will surely depend on that. Jul 4, 2019 at 9:31
• Also, have you tried automatic differentiation? Jul 4, 2019 at 9:31
• I'm solving it approximately with a point block Jacobi iteration. AD is impractical, and not what I need, as I just need the derivative of the linear system unknown multiplied by a vector. Which is why I suggested the vector perturbation to the linear system solve.
– EMP
Jul 4, 2019 at 20:50