18 #ifndef PIC_COMPUTER_VISION_NELDER_MEAD_OPT_TEST_FUNCTION_HPP 19 #define PIC_COMPUTER_VISION_NELDER_MEAD_OPT_TEST_FUNCTION_HPP 23 #include "../util/nelder_mead_opt_base.hpp" 39 float function(
float *x,
unsigned int n)
45 float a_x = (
a - x[0]);
46 float y_x2 = x[1] - x[0] * x[0];
48 return a_x * a_x +
b * y_x2 *y_x2;
57 for(
int i = 0; i < 1000; i++) {
59 start[0] = float(rnd() % 1000) * 0.003f;
60 start[1] = float(rnd() % 1000) * 0.002f;
62 float *sol =
test.run(start, 2, 1e-12f, 10000);
63 printf(
"x: %f y: %f f: %f\n", sol[0], sol[1],
test.function(sol, 2));
70 #endif // PIC_COMPUTER_VISION_NELDER_MEAD_OPT_TEST_FUNCTION_HPP static void test()
Definition: nelder_mead_opt_test_function.hpp:51
float b
Definition: nelder_mead_opt_test_function.hpp:31
Definition: nelder_mead_opt_test_function.hpp:27
float a
Definition: nelder_mead_opt_test_function.hpp:31
NelderMeadOptTestFunction(float a, float b)
Definition: nelder_mead_opt_test_function.hpp:33
The NelderMeadOptBase class.
Definition: nelder_mead_opt_base.hpp:31
Definition: bilateral_separation.hpp:25