Your func_linidx_with_slices does not modify du itself, does it? It modifies only the slices, which are copies of some parts. Hence, the ODE algorithm just sees zero change and can step fast without needing to do real work.
Caveat: I’m on my phone and can’t check that right now. This is just a guess based on the code.
5 Likes