Commit cea45407 authored by Davis E. King's avatar Davis E. King

Made find_min_single_variable() a little more efficient.

parent fa43cde6
...@@ -666,7 +666,7 @@ namespace dlib ...@@ -666,7 +666,7 @@ namespace dlib
// if f1 is small then take a step to the left // if f1 is small then take a step to the left
if (f1 < f3) if (f1 <= f3)
{ {
// check if the minimum is butting up against the bounds and if so then pick // check if the minimum is butting up against the bounds and if so then pick
// a point between p1 and p2 in the hopes that shrinking the interval will // a point between p1 and p2 in the hopes that shrinking the interval will
...@@ -769,7 +769,7 @@ namespace dlib ...@@ -769,7 +769,7 @@ namespace dlib
// make sure one side of the bracket isn't super huge compared to the other // make sure one side of the bracket isn't super huge compared to the other
// side. If it is then contract it. // side. If it is then contract it.
const double bracket_ratio = abs(p1-p2)/abs(p2-p3); const double bracket_ratio = abs(p1-p2)/abs(p2-p3);
if ( !( bracket_ratio < 100 && bracket_ratio > 0.01) ) if ( !( bracket_ratio < 10 && bracket_ratio > 0.1) )
{ {
// Force p_min to be on a reasonable side. But only if lagrange_poly_min_extrap() // Force p_min to be on a reasonable side. But only if lagrange_poly_min_extrap()
// didn't put it on a good side already. // didn't put it on a good side already.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment