pub fn partial_hessian<G, T: DualNum<F>, F: DualNumFloat, M: Dim, N: Dim, O: Mappable<HyperDualVec<T, F, M, N>>>(
g: G,
(x, y): (&OVector<T, M>, &OVector<T, N>),
) -> O::Output<(T, OVector<T, M>, OVector<T, N>, OMatrix<T, M, N>)>where
G: Fn((OVector<HyperDualVec<T, F, M, N>, M>, OVector<HyperDualVec<T, F, M, N>, N>)) -> O,
DefaultAllocator: Allocator<N> + Allocator<M> + Allocator<M, N> + Allocator<U1, N>,Expand description
Calculate second partial derivatives with respect to vectors.
let x = SVector::from([4.0, 3.0]);
let y = SVector::from([5.0]);
let fun = |(x, y): (SVector<HyperDualSVec64<2, 1>, 2>, SVector<HyperDualSVec64<2, 1>, 1>)|
y[0] / (x[0].powi(2) + x[1].powi(2)).sqrt();
let (f, dfdx, dfdy, d2fdxdy) = partial_hessian(fun, (&x, &y));
assert_eq!(f, 1.0);
assert_relative_eq!(dfdx[0], -0.16);
assert_relative_eq!(dfdx[1], -0.12);
assert_relative_eq!(dfdy[0], 0.2);
assert_relative_eq!(d2fdxdy[0], -0.032);
assert_relative_eq!(d2fdxdy[1], -0.024);