DiffEqOperators.jl icon indicating copy to clipboard operation
DiffEqOperators.jl copied to clipboard

Clarification: JacVecOperator interface

Open lindnemi opened this issue 4 years ago • 3 comments

Hi, I'm trying to implement a custom JacVecOperator.

In the docs it sounds like L(u,p,t) should be multiplication of L with a vector u. If L = Jac(x) is some Jacobian at location x that would be the directional derivative Jac(x) * u.

On the other hand here it seems that the function call L(u,p,t) will always evaluate to Jac(u) * u. Meaning that the direction and the point at which Jac is evaluated will always be the same.

In this case, how am I supposed to implement the general directional derivative Jac(u) * z where z is an arbitrary direction?

lindnemi avatar Feb 01 '21 16:02 lindnemi

* should not update the Jacobian, as you say that would allow Jac(x) * u. Using L(u,p,t) as a function inside of the ODE defines the ODE Jac(u)*u which is a representation of the original nonlinear operator and is thus useful in things like local sensitivity analysis, hence the default.

ChrisRackauckas avatar Feb 02 '21 01:02 ChrisRackauckas

Thank you for the quick answer. So there are basically three things to implement for a JacVecOperator:

  • L(u,p,t) for Jac(u) * u
  • * for Jac(u) * x
  • update_coefficients

Each of which should be given in mutating and oop form. I would love to see a brief section specifically about JacVecOperator in the docs.

lindnemi avatar Feb 02 '21 08:02 lindnemi

Yes, http://diffeqoperators.sciml.ai/dev/operators/jacobian_vector_product/ needs a bit more.

ChrisRackauckas avatar Feb 02 '21 10:02 ChrisRackauckas