implicit_derivative_vec

Function implicit_derivative_vec 

Source
pub fn implicit_derivative_vec<G, D: DualNum<F> + Copy, F: DualNumFloat, A: DualStruct<DualVec<D, F, N>, F>, N: Dim>(
    g: G,
    x: OVector<F, N>,
    args: &A::Inner,
) -> OVector<D, N>
where DefaultAllocator: Allocator<N> + Allocator<N, N> + Allocator<U1, N>, G: Fn(OVector<DualVec<D, F, N>, N>, &A) -> OVector<DualVec<D, F, N>, N>,
Expand description

Calculate the derivative of the multivariate implicit function g(x, args) = 0

let a = Dual64::from(4.0).derivative();
let x = implicit_derivative_vec(
    |x, a| SVector::from([x[0] * x[1] - a, x[0] + x[1] - a - 1.0]),
    SVector::from([1.0f64, 4.0f64]),
    &a,
    );
assert_relative_eq!(x[0].re, 1.0, max_relative = 1e-16);
assert_relative_eq!(x[0].eps, 0.0, max_relative = 1e-16);
assert_relative_eq!(x[1].re, a.re, max_relative = 1e-16);
assert_relative_eq!(x[1].eps, a.eps, max_relative = 1e-16);