jax-js
    Preparing search index...

    Function hessian

    • Compute the Hessian matrix of a scalar-valued function.

      The Hessian is the matrix of second-order partial derivatives of a function. This is implemented as jacfwd(grad(f)).

      Type Parameters

      Parameters

      Returns (...args: MappedJsTree<Parameters<F>, Array, ArrayLike>) => ReturnType<F>

      const f = (x: np.Array) => np.sum(x.ref.mul(x.ref).mul(x)); // x^3
      const H = hessian(f)(np.array([1, 2, 3]));
      // H[i,j] = d^2f / dx_i dx_j