Trait argmin_core::ArgminOperator
source · pub trait ArgminOperator {
type Parameters;
type OperatorOutput;
type Hessian;
fn apply(&self, _: &Self::Parameters) -> Result<Self::OperatorOutput, Error>;
fn gradient(&self, : &Self::Parameters) -> Result<Self::Parameters, Error> { ... }
fn hessian(&self, : &Self::Parameters) -> Result<Self::Hessian, Error> { ... }
fn modify(
&self,
: &Self::Parameters,
: f64
) -> Result<Self::Parameters, 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
sourcetype Parameters
type Parameters
Type of the parameter vector
sourcetype OperatorOutput
type OperatorOutput
Output of the operator. Most solvers expect f64
.
Required Methods
sourcefn apply(&self, _: &Self::Parameters) -> Result<Self::OperatorOutput, Error>
fn apply(&self, _: &Self::Parameters) -> Result<Self::OperatorOutput, Error>
Applies the operator/cost function to parameters
Provided Methods
sourcefn gradient(&self, : &Self::Parameters) -> Result<Self::Parameters, Error>
fn gradient(&self, : &Self::Parameters) -> Result<Self::Parameters, Error>
Computes the gradient at the given parameters
sourcefn hessian(&self, : &Self::Parameters) -> Result<Self::Hessian, Error>
fn hessian(&self, : &Self::Parameters) -> Result<Self::Hessian, Error>
Computes the hessian at the given parameters
sourcefn modify(&self, : &Self::Parameters, : f64) -> Result<Self::Parameters, Error>
fn modify(&self, : &Self::Parameters, : f64) -> Result<Self::Parameters, Error>
Modifies a parameter vector. Comes with a variable that indicates the “degree” of the modification.