13#ifndef OPTIMIST_VECTOR_FUNCTION_ROSENBROCK_HH
14#define OPTIMIST_VECTOR_FUNCTION_ROSENBROCK_HH
42 template <
typename Real, Integer N>
45 static_assert(N > 0 && N % 2 == 0,
"please use an even number of dimensions");
60 this->
m_guesses.emplace_back(Vector::Ones());
61 for (
Integer i{0}; i < N; i += 2) {
71 std::string
name_impl()
const {
return "Rosenbrock<" + std::to_string(N) +
">";}
80 for (
Integer i{0}; i < N; i += 2) {
81 out(i) = 10.0*(x(i+1) - x(i)*x(i));
82 out(i+1) = 1.0 - x(i);
93 for (
Integer i{0}; i < N; i += 2) {
94 out(i, i) = -20.0*x(i);
108 for (
Integer i{0}; i < static_cast<Integer>(out.size()); ++i) {
110 for (
Integer j{0}; j < N; j += 2) {
111 out[i](j, j) = -20.0;
122 template <
typename Real>
129 template <
typename Real>
136 template <
typename Real>
143 template <
typename Real>
150 template <
typename Real>
#define OPTIMIST_BASIC_CONSTANTS(Real)
Definition Optimist.hh:70
std::vector< InputType > m_solutions
Definition Function.hh:52
std::vector< InputType > m_guesses
Definition Function.hh:53
constexpr Integer output_dimension() const
Definition Function.hh:107
Class container for the extended Rosenbrock function.
Definition Rosenbrock.hh:44
void second_derivative_impl(const Vector &, Tensor &out) const
Definition Rosenbrock.hh:105
void first_derivative_impl(const Vector &x, Matrix &out) const
Definition Rosenbrock.hh:90
typename VectorFunction< Real, N, N, Rosenbrock< Real, N > >::InputVector Vector
Definition Rosenbrock.hh:50
Rosenbrock()
Definition Rosenbrock.hh:57
std::string name_impl() const
Definition Rosenbrock.hh:71
void evaluate_impl(const Vector &x, Vector &out) const
Definition Rosenbrock.hh:78
typename VectorFunction< Real, N, N, Rosenbrock< Real, N > >::Tensor Tensor
Definition Rosenbrock.hh:52
typename VectorFunction< Real, N, N, Rosenbrock< Real, N > >::Matrix Matrix
Definition Rosenbrock.hh:51
VectorFunction()
Definition VectorFunction.hh:55
typename Function< Real, N, M, Rosenbrock< Real, N > >::InputType InputVector
Definition VectorFunction.hh:45
Rosenbrock< Real, 2 > Rosenbrock2
Class container for the 2D Rosenbrock function.
Definition Rosenbrock.hh:123
Rosenbrock< Real, 4 > Rosenbrock4
Class container for the 4D Rosenbrock function.
Definition Rosenbrock.hh:130
Rosenbrock< Real, 8 > Rosenbrock8
Class container for the 8D Rosenbrock function.
Definition Rosenbrock.hh:144
Rosenbrock< Real, 6 > Rosenbrock6
Class container for the 6D Rosenbrock function.
Definition Rosenbrock.hh:137
Rosenbrock< Real, 10 > Rosenbrock10
Class container for the 10D Rosenbrock function.
Definition Rosenbrock.hh:151
Namespace for the Optimist library.
Definition Optimist.hh:87
OPTIMIST_DEFAULT_INTEGER_TYPE Integer
The Integer type as used for the API.
Definition Optimist.hh:95