derivkit.calculus.gradient module#

Contains functions used to construct the gradient of scalar-valued functions.

derivkit.calculus.gradient.build_gradient(function: Callable, theta0: ndarray, method: str | None = None, n_workers=1, **dk_kwargs: dict) ndarray#

Returns the gradient of a scalar-valued function.

Parameters:
Returns:

A 1D array representing the gradient.

Raises:

TypeError – If function does not return a scalar value.