bundles / scipy 1.17.1 / scipy / optimize / _numdiff / _adjust_scheme_to_bounds
function
scipy.optimize._numdiff:_adjust_scheme_to_bounds
source: /scipy/optimize/_numdiff.py :14
Signature
def _adjust_scheme_to_bounds ( x0 , h , num_steps , scheme , lb , ub ) Summary
Adjust final difference scheme to the presence of bounds.
Parameters
x0: ndarray, shape (n,)Point at which we wish to estimate derivative.
h: ndarray, shape (n,)Desired absolute finite difference steps.
num_steps: intNumber of
hsteps in one direction required to implement finite difference scheme. For example, 2 means that we need to evaluate f(x0 + 2 * h) or f(x0 - 2 * h)scheme: {'1-sided', '2-sided'}Whether steps in one or both directions are required. In other words '1-sided' applies to forward and backward schemes, '2-sided' applies to center schemes.
lb: ndarray, shape (n,)Lower bounds on independent variables.
ub: ndarray, shape (n,)Upper bounds on independent variables.
Returns
h_adjusted: ndarray, shape (n,)Adjusted absolute step sizes. Step size decreases only if a sign flip or switching to one-sided scheme doesn't allow to take a full step.
use_one_sided: ndarray of bool, shape (n,)Whether to switch to one-sided scheme. Informative only for
scheme='2-sided'.
Aliases
-
scipy.optimize._numdiff._adjust_scheme_to_bounds