DiffEqOperators.jl
DiffEqOperators.jl copied to clipboard
Clarification: JacVecOperator interface
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?
*
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.
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.
Yes, http://diffeqoperators.sciml.ai/dev/operators/jacobian_vector_product/ needs a bit more.