Skip to main content

Objective

Trait Objective 

Source
pub trait Objective: Sync {
    // Required methods
    fn dim(&self) -> usize;
    fn value(&self, x: &[f64]) -> Result<Eval>;
    fn gradient(&self, x: &[f64]) -> Result<(Eval, Vec<f64>)>;
    fn hessian(&self, x: &[f64]) -> Result<(Eval, Vec<f64>, DMatrix<f64>)>;

    // Provided method
    fn hvp(&self, x: &[f64], v: &[f64]) -> Result<Vec<f64>> { ... }
}
Expand description

A function to minimise.

Required Methods§

Source

fn dim(&self) -> usize

Number of parameters.

Source

fn value(&self, x: &[f64]) -> Result<Eval>

The objective at x.

Source

fn gradient(&self, x: &[f64]) -> Result<(Eval, Vec<f64>)>

The objective and its gradient at x.

Source

fn hessian(&self, x: &[f64]) -> Result<(Eval, Vec<f64>, DMatrix<f64>)>

The objective, its gradient and its Hessian at x.

Provided Methods§

Source

fn hvp(&self, x: &[f64], v: &[f64]) -> Result<Vec<f64>>

The Hessian at x applied to v. The default forms the whole Hessian; objectives that can do better override it.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§