srenevey / ode-solvers

Numerical methods to solve ordinary differential equations in Rust.
BSD 3-Clause "New" or "Revised" License
64 stars 26 forks source link

Don't heap allocate Butcher tableau. #17

Closed lopsided98 closed 1 year ago

lopsided98 commented 1 year ago

The Butcher tableau is just a table of constants, so there is no reason to heap allocate it each time the solver is initialized. For some simple ODEs, I have observed that the solver spends more than 50% of its time allocating and freeing the tableau.

Now that the Dopri54/Dopri853 structs no longer store any data, I decided to simply remove them and make the coefficient functions into free functions in appropriately named modules.