pttools.speedup.differential

Utilities for handling functions for the differential equations

Classes

class pttools.speedup.differential.DifferentialCache

Bases: object

Cache for the functions that compute the differentials

This cache system automatically compiles versions for scipy.integrate.odeint(), scipy.integrate.solve_ivp() and NumbaLSODA.

add(name, differential, p_last_is_backwards=True, ndim=3)
Parameters:
  • name (str)

  • differential (Callable[[float, ndarray, ndarray, ndarray | None], None] | CFunc)

  • p_last_is_backwards (bool)

  • ndim (int)

Return type:

(float64, float64*, float64*, float64*) -> none*

get_njit(key)

Get a Numba-jitted function

Parameters:

key ((float64, float64*, float64*, float64*) -> none* | str)

Return type:

Callable[[float, ndarray, ndarray, ndarray | None], None] | CFunc

get_odeint(key)

Get a function compatible with SciPy odeint

Parameters:

key ((float64, float64*, float64*, float64*) -> none* | str)

Return type:

Callable[[ndarray, float, ndarray | None], ndarray] | CPUDispatcher

get_pointer(name)

Get a pointer to the function from its name

Parameters:

name (str)

Return type:

(float64, float64*, float64*, float64*) -> none*

get_solve_ivp(key)

Get a function compatible with SciPy solve_ivp

Parameters:

key ((float64, float64*, float64*, float64*) -> none* | str)

Return type:

Callable[[float, ndarray, ndarray | None], ndarray] | CPUDispatcher

keys()

Get the keys in the cache