13#ifndef OPTIMIST_TESTSET_ROSENBROCK_HH
14#define OPTIMIST_TESTSET_ROSENBROCK_HH
41 template <
typename Real, Integer N>
44 static_assert(N > 0 && N % 2 == 0,
"please use an even number of dimensions");
59 this->
m_guesses.emplace_back(Vector::Ones());
60 for (
Integer i{0}; i < N; i += 2) {
70 std::string
name_impl()
const {
return "Rosenbrock<" + std::to_string(N) +
">";}
79 for (
Integer i{0}; i < N; i += 2) {
80 out(i) = 10.0*(x(i+1) - x(i)*x(i));
81 out(i+1) = 1.0 - x(i);
92 for (
Integer i{0}; i < N; i += 2) {
93 out(i, i) = -20.0*x(i);
107 for (
Integer i{0}; i < static_cast<Integer>(out.size()); ++i) {
109 for (
Integer j{0}; j < N; j += 2) {
110 out[i](j, j) = -20.0;
121 template <
typename Real>
128 template <
typename Real>
135 template <
typename Real>
142 template <
typename Real>
149 template <
typename Real>
#define OPTIMIST_BASIC_CONSTANTS(Real)
Definition Optimist.hh:70
std::vector< InputType > m_guesses
Definition Function.hh:63
std::vector< InputType > m_solutions
Definition Function.hh:62
constexpr Integer output_dimension() const
Definition Function.hh:117
typename FunctionBase< Real, N, M, Rosenbrock< Real, N >, false >::InputType InputVector
Definition Function.hh:193
Function()
Definition Function.hh:203
Class container for the extended Rosenbrock function.
Definition Rosenbrock.hh:43
void second_derivative_impl(const Vector &, Tensor &out) const
Definition Rosenbrock.hh:104
typename Function< Real, N, N, Rosenbrock< Real, N > >::Tensor Tensor
Definition Rosenbrock.hh:51
void first_derivative_impl(const Vector &x, Matrix &out) const
Definition Rosenbrock.hh:89
Rosenbrock()
Definition Rosenbrock.hh:56
std::string name_impl() const
Definition Rosenbrock.hh:70
void evaluate_impl(const Vector &x, Vector &out) const
Definition Rosenbrock.hh:77
typename Function< Real, N, N, Rosenbrock< Real, N > >::InputVector Vector
Definition Rosenbrock.hh:49
typename Function< Real, N, N, Rosenbrock< Real, N > >::Matrix Matrix
Definition Rosenbrock.hh:50
Rosenbrock< Real, 2 > Rosenbrock2
Class container for the 2D Rosenbrock function.
Definition Rosenbrock.hh:122
Rosenbrock< Real, 4 > Rosenbrock4
Class container for the 4D Rosenbrock function.
Definition Rosenbrock.hh:129
Rosenbrock< Real, 8 > Rosenbrock8
Class container for the 8D Rosenbrock function.
Definition Rosenbrock.hh:143
Rosenbrock< Real, 6 > Rosenbrock6
Class container for the 6D Rosenbrock function.
Definition Rosenbrock.hh:136
Rosenbrock< Real, 10 > Rosenbrock10
Class container for the 10D Rosenbrock function.
Definition Rosenbrock.hh:150
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