twpasolver.cmes.rk45 module#
Cacheable RK45 integrator for use inside njit dispatch functions.
Adapted from CyRK’s nbsolve_ivp (https://github.com/jrenaud90/CyRK,
Copyright Joe P. Renaud and CyRK contributors, Apache License 2.0), reduced
to the Dormand-Prince RK45 path without capture_extra/interpolate_extra.
CyRK’s nbsolve_ivp cannot be cached: its Butcher-tableau coefficients are
module-level np.array globals, which Numba compiles as “dynamic globals”
(runtime addresses that do not survive a restart), and that disables caching
of every njit caller, including the parallel dispatch functions in
base.py/bloch_fb.py (NumbaWarning: Cannot cache ... as it uses dynamic
globals). rk45_solve avoids this by building the tableau inside the
function body, and by being inline="always" with a statically known
diffeq at each call site, so no runtime function pointer survives into
the caller’s compiled code.
- twpasolver.cmes.rk45.rk45_solve(diffeq, t_span: Tuple[float, float], y0: ndarray, t_eval: ndarray, first_step: float, args: tuple = (), rtol: float = 0.001, atol: float = 1e-06, max_num_steps: int = 0, max_steps_per_cell: float = 0.0) ndarray[source]#
Adaptive Dormand-Prince RK45.
Scalar tolerances, a given positive
first_stepand a non-emptyt_evalsorted along the integration direction (the only way it is called); returns the solution ont_evalfrom the fourth-order dense output, shape(y_size, t_eval.size), NaN past a failed integration.