MCPcopy Create free account
hub / github.com/davisking/dlib / rosen

Function rosen

examples/optimization_ex.cpp:36–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34// ----------------------------------------------------------------------------------------
35
36double rosen (const column_vector& m)
37/*
38 This function computes what is known as Rosenbrock's function. It is
39 a function of two input variables and has a global minimum at (1,1).
40 So when we use this function to test out the optimization algorithms
41 we will see that the minimum found is indeed at the point (1,1).
42*/
43{
44 const double x = m(0);
45 const double y = m(1);
46
47 // compute Rosenbrock's function and return the result
48 return 100.0*pow(y - x*x,2) + pow(1 - x,2);
49}
50
51// This is a helper function used while optimizing the rosen() function.
52const column_vector rosen_derivative (const column_vector& m)

Callers 1

operator()Method · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected