Function rosenbrock_derivative

Source
pub fn rosenbrock_derivative<T>(x: &T, a: Scalar, b: Scalar) -> T
where T: FromIterator<Scalar> + Tensor<Item = Scalar>,
Expand description

Returns the derivative of the Rosenbrock function.

\frac{\partial f}{\partial x_i} = \begin{cases}
&\!\!\!\!\!\!-2(a - x_i) - 4bx_i(x_{i+1} - x_i^2), & i=1\\
2b(x_i - x_{i-1}^2) &\!\!\!\!\!\!- 2(a - x_i) - 4bx_i(x_{i+1} - x_i^2), & 1<i<N\\
2b(x_i - x_{i-1}^2),&\!\!\!\!\!\! & i=N \end{cases}