Julia: When to type true or false in DifferentialEquations systems?

Viewed 50

I'm drawing inspiration from the source code of DiffEqFinancial.jl to properly set up my own system. I do not understand the purpose of true and false in the code snippets below:

sde_f = SDEFunction{true}(f,g)

SDEProblem{false}(f,g,u0,tspan;kwargs...)

So what do {true} and {false} do in this context?

I'd like to know if I should have it in my own user code too. I am vaguely aware of the adage to "strictly type types, loosely type functions," so I wonder why the typing here.

1 Answers

A few hours after posting my question, I found the answer by the author himself, Chris Rackauckas. Quote:

if you are creating thousands of really small ODEProblems and want to avoid the dynamic checking going on, then you should do ODEProblem{false}(...) or ODEProblem{true}(...), i.e. directly declare whether it’s in in-place or out-of-place form. Normally this isn’t a huge deal so it’s not mentioned very often in the documentation, but it’s in there since there are scenarios where this helps.

Source: Chris Rackauckas

Related