mirror of https://github.com/davisking/dlib.git
work around bug in gcc 4.8
This commit is contained in:
parent
869097c809
commit
600e036552
|
@ -281,12 +281,31 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
|
|||
std::vector<function_spec> specs,
|
||||
const std::chrono::nanoseconds max_runtime,
|
||||
const max_function_calls num,
|
||||
double solver_epsilon = 0,
|
||||
double solver_epsilon,
|
||||
Args&& ...args
|
||||
)
|
||||
{
|
||||
return find_max_global(ymult, tp, functions, std::move(specs), num, max_runtime, solver_epsilon, std::forward<Args>(args)...);
|
||||
}
|
||||
// This overload shouldn't be required but it works around a bug in gcc 4.8 which has a bug
|
||||
// that makes it complain about setting a default for solver_epsilon but then following it
|
||||
// by args that "isn't defaulted" according to gcc 4.8.
|
||||
template <
|
||||
typename funct,
|
||||
typename ...Args
|
||||
>
|
||||
std::pair<size_t,function_evaluation> find_max_global (
|
||||
double ymult,
|
||||
thread_pool& tp,
|
||||
std::vector<funct>& functions,
|
||||
std::vector<function_spec> specs,
|
||||
const std::chrono::nanoseconds max_runtime,
|
||||
const max_function_calls num,
|
||||
double solver_epsilon = 0
|
||||
)
|
||||
{
|
||||
return find_max_global(ymult, tp, functions, std::move(specs), num, max_runtime, solver_epsilon);
|
||||
}
|
||||
|
||||
// This overload allows the num argument to be skipped.
|
||||
template <
|
||||
|
|
|
@ -187,6 +187,16 @@ namespace
|
|||
DLIB_TEST_MSG(max(abs(true_x-result.x)) < 1e-5, max(abs(true_x-result.x)));
|
||||
print_spinner();
|
||||
|
||||
result = find_max_global(rosen, {0.1, 0.1}, {2, 2}, std::chrono::seconds(5), max_function_calls(100));
|
||||
dlog << LINFO << "rosen: " << trans(result.x);
|
||||
DLIB_TEST_MSG(max(abs(true_x-result.x)) < 1e-5, max(abs(true_x-result.x)));
|
||||
print_spinner();
|
||||
|
||||
result = find_max_global(rosen, {0.1, 0.1}, {2, 2}, max_function_calls(100), std::chrono::seconds(5));
|
||||
dlog << LINFO << "rosen: " << trans(result.x);
|
||||
DLIB_TEST_MSG(max(abs(true_x-result.x)) < 1e-5, max(abs(true_x-result.x)));
|
||||
print_spinner();
|
||||
|
||||
|
||||
result = find_max_global(rosen, {0.1, 0.1}, {2, 2}, {false,false}, max_function_calls(100));
|
||||
dlog << LINFO << "rosen: " << trans(result.x);
|
||||
|
|
Loading…
Reference in New Issue