[][src]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 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.

Fields

cost_func_count: u64grad_func_count: u64hessian_func_count: u64modify_func_count: u64

Methods

impl<O> OpWrapper<O> where
    O: ArgminOp
[src]

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

Constructor

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

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>
[src]

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>
[src]

Calls the hessian method of op and increments hessian_func_count.

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

Calls the modify method of op and increments modify_func_count.

pub fn consume_op(&mut self, other: OpWrapper<O>)[src]

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

pub fn reset(self) -> OpWrapper<O>[src]

Reset the cost function counts to zero

pub fn get_op(self) -> O[src]

Returns the operator op by taking ownership of self.

pub fn clone_op(&self) -> O[src]

Returns a clone of the operator op.

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

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

Trait Implementations

impl<O> ArgminOp for OpWrapper<O> where
    O: ArgminOp
[src]

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

impl<O> Clone for OpWrapper<O> where
    O: ArgminOp + Clone
[src]

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

Performs copy-assignment from source. Read more

impl<O> Serialize for OpWrapper<O> where
    O: ArgminOp + Serialize
[src]

impl<O> Debug for OpWrapper<O> where
    O: ArgminOp + Debug
[src]

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

Auto Trait Implementations

impl<O> Send for OpWrapper<O>

impl<O> Sync for OpWrapper<O>

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

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

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

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