argmin::core

Trait ArgminOp

Source
pub trait ArgminOp {
    type Param: Clone + Serialize + DeserializeOwned;
    type Output: Clone + Serialize + DeserializeOwned;
    type Hessian: Clone + Serialize + DeserializeOwned;
    type Jacobian: Clone + Serialize + DeserializeOwned;
    type Float: ArgminFloat;

    // Provided methods
    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 jacobian(&self, _param: &Self::Param) -> Result<Self::Jacobian, Error> { ... }
    fn modify(
        &self,
        _param: &Self::Param,
        _extent: Self::Float,
    ) -> Result<Self::Param, Error> { ... }
}
Expand description

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.

Required Associated Types§

Source

type Param: Clone + Serialize + DeserializeOwned

Type of the parameter vector

Source

type Output: Clone + Serialize + DeserializeOwned

Output of the operator

Source

type Hessian: Clone + Serialize + DeserializeOwned

Type of Hessian

Source

type Jacobian: Clone + Serialize + DeserializeOwned

Type of Jacobian

Source

type Float: ArgminFloat

Precision of floats

Provided Methods§

Source

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

Applies the operator/cost function to parameters

Source

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

Computes the gradient at the given parameters

Source

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

Computes the Hessian at the given parameters

Source

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

Computes the Hessian at the given parameters

Source

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

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

Implementors§