pub struct MinimizeResult<T: Float> {
pub x: Tensor<T>,
pub f_val: T,
pub grad: Option<Tensor<T>>,
pub iterations: usize,
pub f_evals: usize,
pub g_evals: usize,
pub converged: bool,
}Expand description
Result of a multi-dimensional minimization algorithm.
§Examples
let f = |x: &Tensor<f64>| { let s = x.as_slice(); s[0] * s[0] + s[1] * s[1] };
let g = |x: &Tensor<f64>| {
let s = x.as_slice();
Tensor::from_vec(vec![2.0 * s[0], 2.0 * s[1]], vec![2]).unwrap()
};
let x0 = Tensor::from_vec(vec![3.0_f64, 4.0], vec![2]).unwrap();
let result = bfgs(f, g, &x0, &MinimizeOptions::default()).unwrap();
assert!(result.converged);Fields§
§x: Tensor<T>The estimated minimizer.
f_val: TThe function value at the minimizer.
grad: Option<Tensor<T>>The gradient at the minimizer (if available).
iterations: usizeNumber of iterations performed.
f_evals: usizeNumber of function evaluations.
g_evals: usizeNumber of gradient evaluations.
converged: boolWhether the algorithm converged.
Trait Implementations§
Source§impl<T: Clone + Float> Clone for MinimizeResult<T>
impl<T: Clone + Float> Clone for MinimizeResult<T>
Source§fn clone(&self) -> MinimizeResult<T>
fn clone(&self) -> MinimizeResult<T>
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 moreAuto Trait Implementations§
impl<T> Freeze for MinimizeResult<T>where
T: Freeze,
impl<T> RefUnwindSafe for MinimizeResult<T>where
T: RefUnwindSafe,
impl<T> Send for MinimizeResult<T>
impl<T> Sync for MinimizeResult<T>
impl<T> Unpin for MinimizeResult<T>where
T: Unpin,
impl<T> UnsafeUnpin for MinimizeResult<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for MinimizeResult<T>where
T: UnwindSafe,
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