pub struct GradientComputer {
pub method: GradientMethod,
pub epsilon: f64,
pub parallel: bool,
}Expand description
Gradient computation utilities
Fields§
§method: GradientMethod§epsilon: f64§parallel: boolImplementations§
Source§impl GradientComputer
impl GradientComputer
Sourcepub fn with_method(self, method: GradientMethod) -> Self
pub fn with_method(self, method: GradientMethod) -> Self
Set gradient method
Sourcepub fn with_epsilon(self, eps: f64) -> Self
pub fn with_epsilon(self, eps: f64) -> Self
Set finite difference epsilon
Sourcepub fn with_parallel(self, parallel: bool) -> Self
pub fn with_parallel(self, parallel: bool) -> Self
Enable parallel computation
Sourcepub fn compute_gradient<F>(
&self,
f: F,
x: &ArrayView1<'_, f64>,
) -> UtilsResult<Array1<f64>>
pub fn compute_gradient<F>( &self, f: F, x: &ArrayView1<'_, f64>, ) -> UtilsResult<Array1<f64>>
Compute numerical gradient using finite differences
Sourcepub fn compute_jacobian<F>(
&self,
f: F,
x: &ArrayView1<'_, f64>,
m: usize,
) -> UtilsResult<Array2<f64>>
pub fn compute_jacobian<F>( &self, f: F, x: &ArrayView1<'_, f64>, m: usize, ) -> UtilsResult<Array2<f64>>
Compute Jacobian matrix for vector-valued functions
Trait Implementations§
Source§impl Clone for GradientComputer
impl Clone for GradientComputer
Source§fn clone(&self) -> GradientComputer
fn clone(&self) -> GradientComputer
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for GradientComputer
impl Debug for GradientComputer
Auto Trait Implementations§
impl Freeze for GradientComputer
impl RefUnwindSafe for GradientComputer
impl Send for GradientComputer
impl Sync for GradientComputer
impl Unpin for GradientComputer
impl UnwindSafe for GradientComputer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more