pub trait Gradient<T: Float>: Send + Sync {
// Required methods
fn grad(&self, x: ArrayView1<'_, T>) -> Array1<T>;
fn dim(&self) -> usize;
}Expand description
First-derivative interface. Types that know an analytic gradient
implement this directly (or via DifferentiableObjective).
When only a black-box Objective is available, wrap it with
FiniteDiffGradient. When a closure or Python grad callable is known,
use AnalyticGradient (or construct a PyObjective with grad_fn).
Required Methods§
Sourcefn grad(&self, x: ArrayView1<'_, T>) -> Array1<T>
fn grad(&self, x: ArrayView1<'_, T>) -> Array1<T>
Gradient of the underlying scalar field at x.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".