bundles / scipy latest / scipy / optimize / _numdiff / _compute_absolute_step
function
scipy.optimize._numdiff:_compute_absolute_step
source: build-install/usr/lib/python3.14/site-packages/scipy/optimize/_numdiff.py:147
Signature
def _compute_absolute_step(rel_step, x0, f0, method)Summary
Computes an absolute step from a relative step for finite difference calculation.
Parameters
rel_step: None or array-likeRelative step for the finite difference calculation
x0: np.ndarrayParameter vector
f0: np.ndarray or scalarmethod: {'2-point', '3-point', 'cs'}
Returns
h: np.arrayThe absolute step size,
h.dtype==x0.dtype.
Notes
h has the same dtype as x0 because dx is later calculated as (x0 + h) - x0, and problems would occur if x0.dtype==np.float16 with h.dtype==np.float64. If rel_step is None, then a default relative step is calculated using the smallest floating point type of x0 and f0, see _eps_for_method.
Aliases
scipy.optimize._numdiff._compute_absolute_step