derivkit.calculus.hyper_hessian module#
Construct third-derivative tensors (“hyper-Hessians”) for scalar- or tensor-valued functions.
- derivkit.calculus.hyper_hessian.build_hyper_hessian(function: Callable[[ArrayLike], float | ndarray], theta0: ndarray[tuple[Any, ...], dtype[float64]] | Sequence[float], *, method: str | None = None, n_workers: int = 1, **dk_kwargs: Any) ndarray[tuple[Any, ...], dtype[float64]]#
Returns the third-derivative tensor (“hyper-Hessian”) of a function.
This function computes all third-order partial derivatives of a scalar- or vector-valued function with respect to its parameters, evaluated at a single point in parameter space. The resulting tensor generalizes the Hessian to third order and is useful for higher-order Taylor expansions, non-Gaussian approximations, and sensitivity analyses beyond quadratic order.
- Parameters:
function – Function to differentiate.
theta0 – 1D Parameter vector where the derivatives are evaluated.
method – Derivative method name or alias. If
None, thederivkit.DerivativeKitdefault is used.n_workers – Outer parallelism across output components (tensor outputs only).
**dk_kwargs – Extra keyword args forwarded to
derivkit.DerivativeKit.differentiate(). You may passinner_workers=<int>here to override inner parallelism.
- Returns:
Third-derivative tensor. For scalar outputs, the result has shape
(p, p, p), wherepis the number of parameters. For tensor-valued outputs with shapeout_shape, the result has shape(*out_shape, p, p, p).- Raises:
ValueError – If
theta0is empty.FloatingPointError – If non-finite values are encountered.