Function rosenbrock

Source
pub fn rosenbrock<T>(param: &[T]) -> T
where T: Float + FromPrimitive + Sum,
Expand description

Multidimensional Rosenbrock test function.

Defined as

$$ f(x_1,\,x_2,\,\ldots,\,x_d) = \sum_{i=1}^{d-1} \left[ (a - x_i)^2 + b(x_{i+1} - x_i^2)^2 \right] $$

where $x_i \in (-\infty, \infty)$, $a = 1$, and $b = 100$.

The global minimum is at $f(x_1,\,x_2,\,\ldots,\, x_d) = f(1,\,1,\,\ldots,\,1) = 0$.

See rosenbrock_ab for a variant that allows choosing a and b freely.