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

Function find_max_using_approximate_derivatives

dlib/optimization/optimization.h:359–389  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

357 typename T
358 >
359 double find_max_using_approximate_derivatives (
360 search_strategy_type search_strategy,
361 stop_strategy_type stop_strategy,
362 const funct& f,
363 T& x,
364 double max_f,
365 double derivative_eps = 1e-7
366 )
367 {
368 COMPILE_TIME_ASSERT(is_matrix<T>::value);
369 // The starting point (i.e. x) must be a column vector.
370 COMPILE_TIME_ASSERT(T::NC <= 1);
371
372 DLIB_CASSERT (
373 is_col_vector(x) && derivative_eps > 0,
374 "\tdouble find_max_using_approximate_derivatives()"
375 << "\n\tYou have to supply column vectors to this function"
376 << "\n\tx.nc(): " << x.nc()
377 << "\n\tderivative_eps: " << derivative_eps
378 );
379
380 // Just negate the necessary things and call the find_min version of this function.
381 return -find_min_using_approximate_derivatives(
382 search_strategy,
383 stop_strategy,
384 negate_function(f),
385 x,
386 -max_f,
387 derivative_eps
388 );
389 }
390
391// ----------------------------------------------------------------------------------------
392// ----------------------------------------------------------------------------------------

Callers 1

test_neg_rosenFunction · 0.85

Calls 4

is_col_vectorFunction · 0.85
negate_functionFunction · 0.85
ncMethod · 0.45

Tested by 1

test_neg_rosenFunction · 0.68