[−][src]Struct mathru::optimization::Gradient
Gradient method
It is assumed that $f \colon D \in \mathbb{R}^n \to \mathbb{R}
$
The idea is, that in every iteration a step is made in direction of
the anti gradient.
x_{k + 1} := x_{k} - \alpha_{k} \nabla f(x_{k})
in order that $f(x_{k + 1}) < f(x_{k})
$.
input: Function $f: \mathbb{R}^n \to \mathbb{R}
$, and initial approximation $x_{0} \in \mathbb{R}^{n}
$
output: $x_{k}
$
-
Initialization: choose $
\sigma \in (0, 1)
$set $
k := 0
$ -
calculate antigradient $
d_{k} := -\nabla f(x_{k})
$set $
\alpha_{k} := 1
$ -
while $
f(x_{k} + \alpha_{k} d_{k}) > f(x_k) - \sigma \alpha_{k} \lvert \lvert d_{k} \rvert \rvert_{2}^{2}
$set $
\alpha_{k} := \alpha_{k} /2
$ -
$
x_{k + 1} := x_{k} + \alpha_{k} d_{k}
$ -
$
k := k + 1
$ go to 2.
Methods
impl Gradient
[src]
pub fn new(sigma: f64, iters: usize) -> Gradient
[src]
Construct an instance of gradient algorithm.
Parameters
sigma: learning rate > 0.0
Examples
use mathru::optimization::Gradient; let gd = Gradient::new(0.3, 10000);
impl Gradient
[src]
pub fn minimize<F: Jacobian<f64>>(
&self,
func: &F,
x_0: &Vector<f64>
) -> OptimResult<Vector<f64>>
[src]
&self,
func: &F,
x_0: &Vector<f64>
) -> OptimResult<Vector<f64>>
Trait Implementations
Auto Trait Implementations
impl Send for Gradient
impl Sync for Gradient
impl Unpin for Gradient
impl UnwindSafe for Gradient
impl RefUnwindSafe for Gradient
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
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<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,