Skip to main content

ParametersAD

Trait ParametersAD 

Source
pub trait ParametersAD<N: Dim>: Residual<N>{
    // Required method
    fn build<D: DualNum<f64, Inner = f64> + Copy>(
        f: impl FnMut(&'static str, bool) -> D,
    ) -> Self::Lifted<D>;

    // Provided methods
    fn parameter_names() -> Vec<&'static str> { ... }
    fn differentiable_parameters() -> Vec<&'static str> { ... }
    fn seed_derivatives<const P: usize>(
        parameter_values: &[f64],
        derivative_names: [&str; P],
    ) -> Self::Lifted<DualSVec<f64, f64, P>> { ... }
}
Expand description

A model that can be evaluated with derivatives of its parameters.

Required Methods§

Source

fn build<D: DualNum<f64, Inner = f64> + Copy>( f: impl FnMut(&'static str, bool) -> D, ) -> Self::Lifted<D>

Build the model by requesting each parameter by name.

Call f(name, differentiable) for each parameter. The order of calls defines the canonical parameter order.

Set differentiable to false for fixed parameters.

Provided Methods§

Source

fn parameter_names() -> Vec<&'static str>

Canonical parameter names in the order defined by build.

Source

fn differentiable_parameters() -> Vec<&'static str>

Parameter names that can be differentiated, in canonical order.

Source

fn seed_derivatives<const P: usize>( parameter_values: &[f64], derivative_names: [&str; P], ) -> Self::Lifted<DualSVec<f64, f64, P>>

Construct the model with derivative seeds for the P named parameters.

  • parameter_values: all parameter values in the canonical order defined by build.
  • derivative_names: names of the parameters to differentiate with respect to. Gradient component i corresponds to derivative_names[i].

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§