{ } Raw JSON

bundles / scipy 1.17.1 / scipy / _lib / _elementwise_iterative_method / _initialize

function

scipy._lib._elementwise_iterative_method:_initialize

source: /scipy/_lib/_elementwise_iterative_method.py :29

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 : callable

An elementwise function with signature

func(x: ndarray, *args) -> ndarray

where each element of x is a finite real and args is a tuple, which may contain an arbitrary number of arrays that are broadcastable with x.

xs : tuple of arrays

Finite real abscissa arrays. Must be broadcastable.

args : tuple, optional

Additional positional arguments to be passed to func.

preserve_shape : bool, default:False

When preserve_shape=False (default), func may be passed arguments of any shape; _scalar_optimization_loop is permitted to reshape and compress arguments at will. When preserve_shape=False, arguments passed to func must have shape shape or shape + (n,), where n is any integer.

xp : namespace

Namespace of array arguments in xs.

Returns

xs, fs, args : tuple of arrays

Broadcasted, writeable, 1D abscissa and function value arrays (or NumPy floats, if appropriate). The dtypes of the xs and fs are xfat; the dtype of the args are unchanged.

shape : tuple of ints

Original shape of broadcasted arrays.

xfat : NumPy dtype

Result dtype of abscissae, function values, and args determined using np.result_type, except integer types are promoted to np.float64.

Raises

: ValueError

If 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