pub trait ParametersAD<N: Dim>: Residual<N>where
DefaultAllocator: Allocator<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§
Sourcefn build<D: DualNum<f64, Inner = f64> + Copy>(
f: impl FnMut(&'static str, bool) -> D,
) -> Self::Lifted<D>
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§
Sourcefn parameter_names() -> Vec<&'static str>
fn parameter_names() -> Vec<&'static str>
Canonical parameter names in the order defined by build.
Sourcefn differentiable_parameters() -> Vec<&'static str>
fn differentiable_parameters() -> Vec<&'static str>
Parameter names that can be differentiated, in canonical order.
Sourcefn seed_derivatives<const P: usize>(
parameter_values: &[f64],
derivative_names: [&str; P],
) -> Self::Lifted<DualSVec<f64, f64, P>>
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 bybuild.derivative_names: names of the parameters to differentiate with respect to. Gradient componenticorresponds toderivative_names[i].
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".