3 ms·
Author here. Yes, f(u,p,t) returning du is the suggested way to do things, but this pattern of updating du through in-place updating is more memory efficient w
by __rito__ 2y ago
Author here.
Yes, f(u,p,t) returning du is the suggested way to do things, but this pattern of updating du through in-place updating is more memory efficient when a system of equations (say 10-100) is involved.
The suggested way, when we don't need to think about memory efficiency, is easier to write and reason about.
I have plans to write more on this topic, and make it to a series. After I finish that, if there is enough interest, I will try and do a benchmark of mutating versus non-mutating styles with varying numbers of equations in a system of DEs.
Thanks for reading the article and providing your opinion.