derivkit.utils.caching module#
Provides wrap_theta_cache_builtin().
- derivkit.utils.caching.wrap_theta_cache_builtin(function: Callable[[ndarray], ndarray], *, number_decimal_places: int = 14, maxsize: int | None = 4096, copy: bool = True) Callable[[ndarray], ndarray]#
Creates a cache for function values.
As part of the caching the input is truncated to a pre-set number of decimal places.
- Parameters:
function – The function to be cached.
number_decimal_places – The number of decimal places to include before truncating.
maxsize – The size of the cache.
copy – A flag that, when set to
True, causes the function to create a copy of the function input.
- Returns:
A caching wrapper of
function()if it is aCallable. Iffunction: is not a ``Callable`()it will be returned instead.