{ } Raw JSON

bundles / scipy 1.18.0 / scipy / optimize / _numdiff / _eps_for_method

_lru_cache_wrapper

scipy.optimize._numdiff:_eps_for_method

source: /scipy/optimize/_numdiff.py:93

Signature

def _eps_for_method(x0_dtype, f0_dtype, method)

Summary

Calculates relative EPS step to use for a given data type and numdiff step method.

Extended Summary

Progressively smaller steps are used for larger floating point types.

Parameters

f0_dtype: np.dtype

dtype of function evaluation

x0_dtype: np.dtype

dtype of parameter vector

method: {'2-point', '3-point', 'cs'}

Returns

: EPS: float

relative step size. May be np.float16, np.float32, np.float64

Notes

The default relative step will be np.float64. However, if x0 or f0 are smaller floating point types (np.float16, np.float32), then the smallest floating point type is chosen.

Aliases

  • scipy.optimize._numdiff._eps_for_method