| 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 | // ---------------------------------------------------------------------------------------- |