Differential equations: Vern family solver, lazy option question

For the Verner family solver of DifferentialEquations.jl, Vern6() through Vern9(), it is documented that the interpolation is “lazy” and

These methods when lazy assume that the parameter vector p will be unchanged between the moment of the interval solving and the interpolation. If p is changed in a ContinuousCallback, or in a DiscreteCallback and the continuous solution is used after the full solution, then set lazy=false .
link

In my code, I used p to allocate the temporary matrix for things like mul! e.g.

hdim = 10

p = (
     x=zeros(Complex{Float64}, hdim, hdim), 
     y=zeros(Complex{Float64}, hdim, hdim)
)

and in the ode problem function, p.x, p.y, etc is used to hold temporary allocations, pseudo-code:

function f!(du,u,p,t)

...
mul!(p.x, a, b)
...

...
du .= p.x .+ p.y

end

so p changes during calculation (different p before and after f! gets called, and different p at different times). However, different input value of p does not change the calculation result since it’s always overwritten inside f!() with e.g. mul!(p.x, a, b). In this case, is the lazy=false option needed? Thanks a lot!

Nope, you’re fine.

1 Like

I thought so. Thanks a lot!