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, the derivkit.DerivativeKit default is used.

  • n_workers – Outer parallelism across output components (tensor outputs only).

  • **dk_kwargs – Extra keyword args forwarded to derivkit.DerivativeKit.differentiate(). You may pass inner_workers=<int> here to override inner parallelism.

Returns:

Third-derivative tensor. For scalar outputs, the result has shape (p, p, p), where p is the number of parameters. For tensor-valued outputs with shape out_shape, the result has shape (*out_shape, p, p, p).

Raises:
  • ValueError – If theta0 is empty.

  • FloatingPointError – If non-finite values are encountered.