Skip to main content

Differentiator

Trait Differentiator 

Source
pub trait Differentiator: NumericPlugin {
    // Required method
    fn diff_at(
        &self,
        cx: &mut Cx,
        f: &Func,
        var: &Symbol,
        point: &Value,
        opt: DiffOpts,
    ) -> Result<Value>;

    // Provided method
    fn diff_callable_at(
        &self,
        cx: &mut Cx,
        f: &NumericCallable,
        var: &Symbol,
        point: &Value,
        opt: DiffOpts,
    ) -> Result<Value> { ... }
}
Expand description

A numeric differentiation backend: computes df/dvar at a point.

Required Methods§

Source

fn diff_at( &self, cx: &mut Cx, f: &Func, var: &Symbol, point: &Value, opt: DiffOpts, ) -> Result<Value>

Evaluates the numeric derivative of f with respect to var at point.

Provided Methods§

Source

fn diff_callable_at( &self, cx: &mut Cx, f: &NumericCallable, var: &Symbol, point: &Value, opt: DiffOpts, ) -> Result<Value>

Evaluates the numeric derivative for any numeric callable.

Differentiators that only sample their input should override this hook. Exact differentiators that require Func metadata inherit the fail-closed Func adapter.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§