[]Struct argmin::prelude::OpWrapper

pub struct OpWrapper<O> where
    O: ArgminOp
{ pub cost_func_count: u64, pub grad_func_count: u64, pub hessian_func_count: u64, pub jacobian_func_count: u64, pub modify_func_count: u64, // some fields omitted }

This wraps an operator and keeps track of how often the cost, gradient and Hessian have been computed and how often the modify function has been called. Usually, this is an implementation detail unless a solver is needed within another solver (such as a line search within a gradient descent method), then it may be necessary to wrap the operator in an OpWrapper.


cost_func_count: u64grad_func_count: u64hessian_func_count: u64jacobian_func_count: u64modify_func_count: u64


impl<O> OpWrapper<O> where
    O: ArgminOp

pub fn new(op: &O) -> OpWrapper<O>


pub fn new_move(op: O) -> OpWrapper<O>

Constructor (moves op)

pub fn apply(
    &mut self,
    param: &<O as ArgminOp>::Param
) -> Result<<O as ArgminOp>::Output, Error>

Calls the apply method of op and increments cost_func_count.

pub fn gradient(
    &mut self,
    param: &<O as ArgminOp>::Param
) -> Result<<O as ArgminOp>::Param, Error>

Calls the gradient method of op and increments gradient_func_count.

pub fn hessian(
    &mut self,
    param: &<O as ArgminOp>::Param
) -> Result<<O as ArgminOp>::Hessian, Error>

Calls the hessian method of op and increments hessian_func_count.

pub fn jacobian(
    &mut self,
    param: &<O as ArgminOp>::Param
) -> Result<<O as ArgminOp>::Jacobian, Error>

Calls the jacobian method of op and increments jacobian_func_count.

pub fn modify(
    &mut self,
    param: &<O as ArgminOp>::Param,
    extent: f64
) -> Result<<O as ArgminOp>::Param, Error>

Calls the modify method of op and increments modify_func_count.

pub fn consume_op<O2>(&mut self, other: OpWrapper<O2>) where
    O2: ArgminOp

Consumes an operator by increasing the function call counts of self by the ones in other.

pub fn reset(self) -> OpWrapper<O>

Reset the cost function counts to zero

pub fn get_op(self) -> O

Returns the operator op by taking ownership of self.

pub fn clone_op(&self) -> O

Returns a clone of the operator op.

pub fn new_from_op(op: &OpWrapper<O>) -> OpWrapper<O>

Creates a new OpWrapper<O> from another OpWrapper<O> by cloning the op and initializing all counts with 0.

Trait Implementations

impl<O> Debug for OpWrapper<O> where
    O: ArgminOp + Debug

impl<'de, O> Deserialize<'de> for OpWrapper<O> where
    O: ArgminOp + Deserialize<'de>, 

impl<O> Serialize for OpWrapper<O> where
    O: ArgminOp + Serialize

impl<O> ArgminOp for OpWrapper<O> where
    O: ArgminOp

The OpWrapper should behave just like any other ArgminOp

type Param = <O as ArgminOp>::Param

Type of the parameter vector

type Output = <O as ArgminOp>::Output

Output of the operator

type Hessian = <O as ArgminOp>::Hessian

Type of Hessian

type Jacobian = <O as ArgminOp>::Jacobian

Type of Jacobian

impl<O> Clone for OpWrapper<O> where
    O: ArgminOp + Clone

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl<O> Send for OpWrapper<O>

impl<O> Sync for OpWrapper<O>

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T> ToOwned for T where
    T: Clone

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> Any for T where
    T: 'static + ?Sized

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 

impl<T> SendSyncUnwindSafe for T where
    T: Send + Sync + UnwindSafe + ?Sized