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

Function test_find_min_single_variable

dlib/test/optimization.cpp:1217–1230  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1215// ----------------------------------------------------------------------------------------
1216
1217 void test_find_min_single_variable()
1218 {
1219 auto f = [](double x) { return (x-0.2)*(x-0.2); };
1220 double x = 0.8;
1221 try
1222 {
1223 find_min_single_variable(f, x, 0, 1, 1e-9);
1224 DLIB_TEST(std::abs(x-0.2) < 1e-7);
1225 }
1226 catch(optimize_single_variable_failure&)
1227 {
1228 DLIB_TEST(false);
1229 }
1230 }
1231
1232// ----------------------------------------------------------------------------------------
1233

Callers 1

perform_testMethod · 0.85

Calls 2

find_min_single_variableFunction · 0.85
absFunction · 0.85

Tested by

no test coverage detected