Nicholaswogan/numbalsoda

Easier passing data to rhs

maedoc opened this issue · 2 comments

Thanks for the package, some 400x faster than plain Python for the system I'm looking at. I just wanted to point out that Numba functions close over their local scope so passing arbitrary (constant?) data can be much easier than in your example. Mine looks like this:

def make_lsoda_func(c,R,dstar,E,F,N):
    @cfunc(lsoda_sig)
    def rhs(t, x, du, p):
        codim3(t,x,c,R,dstar,E,F,N,du)
    return rhs

This is a good way to do it! I'll update the Readme with this example. Only drawback is that changing any parameter requires recompiling the function right?

Yes, that’s true. So it’s good for constants, but complex changing parameters still require your demo.