Struct optimization::NumericalDifferentiation [] [src]

pub struct NumericalDifferentiation<F: Function> { /* fields omitted */ }

Wraps a function for which to provide numeric differentiation.

Uses simple one step forward finite difference with step width h = √εx.

Examples

let square = NumericalDifferentiation::new(Func(|x: &[f64]| {
    x[0] * x[0]
}));

assert!(square.gradient(&[0.0])[0] < 1.0e-3);
assert!(square.gradient(&[1.0])[0] > 1.0);
assert!(square.gradient(&[-1.0])[0] < 1.0);

Methods

impl<F: Function> NumericalDifferentiation<F>
[src]

Creates a new differentiable function by using the supplied function in combination with numeric differentiation to find the derivatives.

Trait Implementations

impl<F: Function> Function for NumericalDifferentiation<F>
[src]

Computes the objective function at a given position x, i.e., f(x) = y.

impl<F: Function> Function1 for NumericalDifferentiation<F>
[src]

Computes the gradient of the objective function at a given position x, i.e., ∀ᵢ ∂/∂xᵢ f(x) = ∇f(x). Read more

impl<F: Function + Default> Default for NumericalDifferentiation<F>
[src]

Returns the "default value" for a type. Read more

impl<F: Problem> Problem for NumericalDifferentiation<F>
[src]

Returns the dimensionality of the input domain.

Returns the input domain of the function in terms of upper and lower, respectively, for each input dimension. Read more

Returns the position as well as the value of the global minimum.

Generates a random and feasible position to start a minimization.

Tests whether the supplied position is legal for this function.