[−][src]Struct argmin_core::OpWrapper
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: u64
grad_func_count: u64
hessian_func_count: u64
jacobian_func_count: u64
modify_func_count: u64
Methods
impl<O: ArgminOp> OpWrapper<O>
[src]
pub fn new(op: &O) -> Self
[src]
Constructor
pub fn new_move(op: O) -> Self
[src]
Constructor (moves op)
pub fn apply(&mut self, param: &O::Param) -> Result<O::Output, Error>
[src]
Calls the apply
method of op
and increments cost_func_count
.
pub fn gradient(&mut self, param: &O::Param) -> Result<O::Param, Error>
[src]
Calls the gradient
method of op
and increments gradient_func_count
.
pub fn hessian(&mut self, param: &O::Param) -> Result<O::Hessian, Error>
[src]
Calls the hessian
method of op
and increments hessian_func_count
.
pub fn jacobian(&mut self, param: &O::Param) -> Result<O::Jacobian, Error>
[src]
Calls the jacobian
method of op
and increments jacobian_func_count
.
pub fn modify(
&mut self,
param: &O::Param,
extent: f64
) -> Result<O::Param, Error>
[src]
&mut self,
param: &O::Param,
extent: f64
) -> Result<O::Param, Error>
Calls the modify
method of op
and increments modify_func_count
.
pub fn consume_op<O2: ArgminOp>(&mut self, other: OpWrapper<O2>)
[src]
Consumes an operator by increasing the function call counts of self
by the ones in
other
.
pub fn reset(self) -> Self
[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>) -> Self
[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> ArgminOp for OpWrapper<O>
[src]
The OpWrapperArgminOp
type Param = O::Param
Type of the parameter vector
type Output = O::Output
Output of the operator
type Hessian = O::Hessian
Type of Hessian
type Jacobian = O::Jacobian
Type of Jacobian
fn apply(&self, param: &Self::Param) -> Result<Self::Output, Error>
[src]
fn gradient(&self, param: &Self::Param) -> Result<Self::Param, Error>
[src]
fn hessian(&self, param: &Self::Param) -> Result<Self::Hessian, Error>
[src]
fn jacobian(&self, param: &Self::Param) -> Result<Self::Jacobian, Error>
[src]
fn modify(&self, param: &Self::Param, extent: f64) -> Result<Self::Param, Error>
[src]
impl<O: Clone + ArgminOp> Clone for OpWrapper<O>
[src]
fn clone(&self) -> OpWrapper<O>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<O: Debug + ArgminOp> Debug for OpWrapper<O>
[src]
impl<O: ArgminOp> Serialize for OpWrapper<O> where
O: Serialize,
[src]
O: Serialize,
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<'de, O: ArgminOp> Deserialize<'de> for OpWrapper<O> where
O: Deserialize<'de>,
[src]
O: Deserialize<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
Auto Trait Implementations
impl<O> Sync for OpWrapper<O>
impl<O> Unpin for OpWrapper<O> where
O: Unpin,
O: Unpin,
impl<O> Send for OpWrapper<O>
impl<O> UnwindSafe for OpWrapper<O> where
O: UnwindSafe,
O: UnwindSafe,
impl<O> RefUnwindSafe for OpWrapper<O> where
O: RefUnwindSafe,
O: RefUnwindSafe,
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> SendSyncUnwindSafe for T where
T: Send + Sync + UnwindSafe + ?Sized,
[src]
T: Send + Sync + UnwindSafe + ?Sized,