pub trait Objective<F: Float> {
// Required methods
fn dim(&self) -> usize;
fn eval_grad(&mut self, x: &[F]) -> (F, Vec<F>);
// Provided methods
fn eval_hessian(&mut self, x: &[F]) -> (F, Vec<F>, Vec<Vec<F>>) { ... }
fn hvp(&mut self, x: &[F], v: &[F]) -> (Vec<F>, Vec<F>) { ... }
}Expand description
Trait for optimization objectives.
Implementors provide function evaluation and gradient computation.
Methods take &mut self to allow caching, eval counting, and internal buffers.
Required Methods§
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".