bundles / scipy latest / scipy / _lib / _elementwise_iterative_method / _initialize
function
scipy._lib._elementwise_iterative_method:_initialize
Signature
def _initialize ( func , xs , args , complex_ok = False , preserve_shape = None , 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.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=False, arguments passed tofuncmust have shape shape orshape + (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