[][src]Trait argmin_core::ArgminOp

pub trait ArgminOp: Clone + Default + Send + Sync {
    type Param: Clone + Default + Send + Sync + Serialize + DeserializeOwned;
    type Output;
    type Hessian: Clone + Default + Send + Sync + Serialize + DeserializeOwned;
    fn apply(&self, _param: &Self::Param) -> Result<Self::Output, Error> { ... }
fn gradient(&self, _param: &Self::Param) -> Result<Self::Param, Error> { ... }
fn hessian(&self, _param: &Self::Param) -> Result<Self::Hessian, Error> { ... }
fn modify(
        &self,
        _param: &Self::Param,
        _extent: f64
    ) -> Result<Self::Param, Error> { ... } }

This trait needs to be implemented for every operator/cost function.

It is required to implement the apply method, all others are optional and provide a default implementation which is essentially returning an error which indicates that the method has not been implemented. Those methods (gradient and modify) only need to be implemented if the uses solver requires it.

Associated Types

type Param: Clone + Default + Send + Sync + Serialize + DeserializeOwned

Type of the parameter vector

type Output

Output of the operator. Most solvers expect f64.

type Hessian: Clone + Default + Send + Sync + Serialize + DeserializeOwned

Type of Hessian

Loading content...

Provided methods

fn apply(&self, _param: &Self::Param) -> Result<Self::Output, Error>

Applies the operator/cost function to parameters

fn gradient(&self, _param: &Self::Param) -> Result<Self::Param, Error>

Computes the gradient at the given parameters

fn hessian(&self, _param: &Self::Param) -> Result<Self::Hessian, Error>

Computes the hessian at the given parameters

fn modify(
    &self,
    _param: &Self::Param,
    _extent: f64
) -> Result<Self::Param, Error>

Modifies a parameter vector. Comes with a variable that indicates the "degree" of the modification.

Loading content...

Implementors

impl ArgminOp for MinimalNoOperator[src]

type Param = Vec<f64>

type Output = f64

type Hessian = Vec<Vec<f64>>

impl<T, U, H> ArgminOp for NoOperator<T, U, H> where
    T: Clone + Default + Debug + Send + Sync + Serialize + DeserializeOwned,
    U: Clone + Default + Debug + Send + Sync + Serialize + DeserializeOwned,
    H: Clone + Default + Debug + Send + Sync + Serialize + DeserializeOwned
[src]

type Param = T

type Output = U

type Hessian = H

Loading content...