bundles / scipy latest / scipy / _lib / _elementwise_iterative_method / _initialize
function
scipy._lib._elementwise_iterative_method:_initialize
source: build-install/usr/lib/python3.14/site-packages/scipy/_lib/_elementwise_iterative_method.py:29
Signature
def _initialize(func, xs, args, kwargs = None, complex_ok = False, multi_output_ok = False, preserve_shape = False, xp = None)Summary
Initialize abscissa, function, and args arrays for elementwise function
Parameters
func: callableAn elementwise function with signature
func(x: ndarray, *args) -> ndarray
where each element of
xis a finite real andargsis a tuple, which may contain an arbitrary number of arrays that are broadcastable withx.xs: tuple of arraysFinite real abscissa arrays. Must be broadcastable.
args: tuple, optionalAdditional positional arguments to be passed to
func.kwargs: tuple, optionalAdditional keyword arguments to be passed to
func.complex_ok: bool, default: FalseWhether complex dtypes are allowed; e.g., True for tanhsinh, False for
_chandrupatla.multi_output_ok: bool, default: FalseWhether the user callable may return multiple outputs as a single array with shape to which
xsandargsare broadcastable to.preserve_shape: bool, default: FalseWhen
preserve_shape=False(default),funcmay be passed arguments of any shape;_scalar_optimization_loopis permitted to reshape and compress arguments at will. Whenpreserve_shape=True, arguments passed tofuncmust have shapeshape + (n,), wherenis any integer.xp: namespaceNamespace of array arguments in
xs.
Returns
xs, fs, args: tuple of arraysBroadcasted, writeable, 1D abscissa and function value arrays (or NumPy floats, if appropriate). The dtypes of the
xsand fs are xfat; the dtype of theargsare unchanged.shape: tuple of intsOriginal shape of broadcasted arrays.
xfat: NumPy dtypeResult dtype of abscissae, function values, and args determined using
np.result_type, except integer types are promoted tonp.float64.
Raises
: ValueErrorIf the result dtype is not that of a real scalar
Notes
Useful for initializing the input of SciPy functions that accept an elementwise callable, abscissae, and arguments; e.g. scipy.optimize._chandrupatla.
Aliases
scipy.differentiate.eim._initialize